Use a shared string buffer type for JS and DOM strings
Categories
(Core :: JavaScript Engine, task, P2)
Tracking
()
People
(Reporter: jandem, Unassigned)
References
(Depends on 2 open bugs, Blocks 2 open bugs)
Details
(Whiteboard: [sp3][js-perf-next])
We have an optimization to avoid copying for strings passed from the DOM to JS (external JS strings), but strings passed from JS to DOM bindings are usually inflated/copied. This copying can have significant performance and memory overhead.
At our work week we discussed some ideas to address this. For longer JS strings, the idea is to use a refcounted string-buffer type (nsStringBuffer
or similar) that's shared with DOM strings. The JS string then holds a reference to this buffer and releases it in its finalizer. This is similar to how external strings work today but applied in a more general way. Shorter strings such as inline strings would still be copied.
Initially we'd still inflate Latin1 strings passed from JS code, but DOM bindings could be converted incrementally to work with Latin1 buffers directly.
This string buffer type could also be used for script sources and the SharedImmutableStringsCache
.
We need to be careful with strings with nursery-allocated characters and mutability (JS strings are immutable, XPCOM string buffers can be mutated).
Updated•5 months ago
|
Updated•5 months ago
|
Updated•5 months ago
|
Updated•4 months ago
|
Comment 1•1 month ago
|
||
js-perf-next: Finish up any remaining worthwhile work on the SM side. Find someone who can take advantage of this on the DOM side.
Description
•