On 10/6/14, 3:32 PM, Cameron Zwarich wrote:
then it wouldn’t be able to use JS_NewExternalString in the places where Gecko 
is able to use it.

Ah, true.

Is there any particular place where you feel there is tension between the goals 
of memory usage and performance?

I don't know yet.  I mean, for charAt, sure.  ;)

One annoying problem that comes up with using UTF-8 in Servo and UTF-16 / 
Latin1 in SpiderMonkey is that repeated accesses of a DOM property would cause 
repeated copying of the same string, so you would need to cache the copies to 
ensure that JS programs have the expected time / space complexity.

You need such a cache anyway for dumb performance reasons: it's hard to be competitive on benchmarks otherwise. Gecko has a one-slot cache. WebKit+JSC had a full-on hashtable last I checked. Gecko only does this for the shareable string case, for various reasons, but it could be done in general.

https://bugzilla.mozilla.org/show_bug.cgi?id=773520 has some data from a few years ago on hit rates for such caches on a totally unscientific but real-life workload.

-Boris
_______________________________________________
dev-servo mailing list
dev-servo@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-servo

Reply via email to