Open Bug 558515 Opened 12 years ago Updated 2 years ago

Consider having some equivalent of swap() or forget() on strings backed by stringbuffers

Categories

(Core :: XPCOM, defect)

x86
macOS
defect
Not set
normal

Tracking

()

People

(Reporter: bzbarsky, Unassigned)

References

(Blocks 1 open bug)

Details

In DOM profiles, the cost of returning a string into the JS engine includes a pretty nontrivial component of having to addref the stringbuffer (when handing it over to JS_NewExternalString) and release it (when our existing string goes out of scope).  It might be good to have a way to have a string forget() its stringbuffer (returning null if it doesn't have one) and to have a swap() function on strings, at least stringbuffer-backed ones.
It looks like bug 577472 did this for the not-on-trace case... but we still need to do this on trace.
And we might still want to fix _this_ bug for methods that write into outparam strings from local on-stack ones.
Component: String → XPCOM
You need to log in before you can comment on or make changes to this bug.