Open Bug 585656 Opened 16 years ago Updated 3 years ago

Consider refcounting string buffers in JS land

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect

Tracking

()

People

(Reporter: bzbarsky, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: perf)

I was looking at the dromaeo results for createTextNode and then looked at how webkit/jsc implements strings, and realized that there's no way we can possibly beat them on that test due to the fact that we copy the strings (twice for most of them) whereas they just addref them. Specifically, their JSString has a single UString member, and UString has a single RefPtr<Rep> member and Rep has a union member like so: union { // If !baseIsSelf() BaseString* m_baseString; // If baseIsSelf() SharedUChar* m_sharedBuffer; }; where "typedef CrossThreadRefCounted<OwnFastMallocPtr<UChar> > SharedUChar". So what I'd like to propose is that we share nsStringBuffer or some such (I plan to file another bug on stealing their CrossThreadRefCounted impl) between the JS engine and XPCOM. Then make JSString refcount stringbuffers when it owns its chars (dependent strings, etc can continue being dependent, as seems to be the case in jsc). Then we can get much faster transitions to and from JS and all win, right?
Blocks: domperf
Keywords: perf
I filed bug 585661 on stealing CrossThreadRefCounted.
Assignee: general → nobody
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.