Open Bug 1471879 Opened 7 years ago Updated 3 years ago

Consider to use nsAutoString in those dictionaries which are only used as params

Categories

(Core :: DOM: Bindings (WebIDL), enhancement, P3)

enhancement

Tracking

()

People

(Reporter: smaug, Unassigned)

Details

See https://perfht.ml/2lComBg as an example. We allocate the string, and allocation is slow.
Or could we use FakeStrings?
Hmm. So we don't want to expose FakeString too much to consumers; it's a binding implementation detail that has to be used a bit carefully. I guess we already do via unions to some extent... This used to not be ok because FakeString was a dependent string, but I guess nowadays it typically isn't when coming from JS. Doing this for dictionaries in general is not too hard. Doing this only for ones used as args would require a bit more work; we don't track that right now.
Priority: -- → P3
So why the "only used as params" limitation? Is the idea to exclude return values? Or exclude members of other dictionaries, or sequence elements, or something else?
Flags: needinfo?(bugs)
Just thinking if return value objects might be stored as member variables or something. Basically want to somehow try avoid higher memory usage, if the object might be heap allocated. Not sure what would be the best way for that.
Flags: needinfo?(bugs)
Component: DOM → DOM: Core & HTML
Component: DOM: Core & HTML → DOM: Bindings (WebIDL)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.