I have some more results. I updated my tracemonkey and v8 builds to
their current svn/hg heads and then compared them to rhino head using
the script below. It's basically a JSON array with 500 objects
containing some string/number/boolean properties, parsed 500 times. I
called the bench() function repeatedly to make sure the Hotspot
compiler had done its job (the tracemonkey and v8 JIT compilers don't
do anything on this level, obviously).
function bench() {
var t0 = Date.now();
for (var i = 0; i < 500; i++)
JSON.parse(src);
return Date.now() - t0;
}
var array = [];
for (var i = 0; i < 500; i++)
array.push({foo: "BAR", x: 12309, y: false,
bar: "sdflkjsldfkjlk sdflkj lsdkjf lkjsd flkjdsf"});
var src = JSON.stringify(array);
Here are the results:
V8: ~1250 millis
Tracemonkey: ~800 millis
Rhino with client hotspot VM: ~2000 millis
Rhino with server hotspot VM ~800 millis
Hannes
On Aug 12, 4:44 pm, Joran <[email protected]> wrote:
> Thanks Hannes. This is great.
>
> After some quick playing, and using the same testparse and
> teststringify functions described above, here are some results. For
> "object", I used an array of 2082 objects. For "string", I used the
> JSON representation of "object". The length of "string" is about
> 650kb. I didn't try anything larger than that.
>
> JSON.parse:
> Rhino (before Hannes' patch): 640ms
> Rhino (after Hannes' patch): 90ms
> TraceMonkey: 44ms
> V8: 27ms
>
> JSON.stringify:
> Rhino (before Hannes' patch): 140ms
> Rhino (after Hannes' patch): 165ms
> V8: 70ms
> TraceMonkey: 44ms
>
> Thanks again, this will mean I also won't have to put a parsed-object
> cache in front of my key-value store (Tokyo Tyrant).
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino