Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rhino VS Spidermonkey performance tests

I have a project I'm working on for my company and right now I need to decide which JS Engine I should use. Currently the choices I have are Spidermonkey or Rhino.

My main concern is performance and scalability, I wanted to know if performance tests to compare the two engines were made?

I found googling this issue harder than I've expected.

Thanks in advance for the help, Ben.

like image 930
Ben Benedek Avatar asked Jan 30 '12 07:01

Ben Benedek


2 Answers

I regularly run V8 and Sunspider benchmarks on both Rhino and Spidermonkey (disclaimer: I'm a committer on the Rhino project). The current Rhino release (1.7R3) is still quite a bit slower than Spidermonkey, but recent git snapshots have caught up nicely. (Note that I'm talking about interpreted Spidermonkey without Jaegermonkey or other JITs - Jaegermonkey is way faster.)

On V8-benchmarks-v5 Rhino 1.7R3 scores around 360 on my machine, Rhino git master 480, Rhino git rhino_1_8 branch 570, and a recent Spidermonkey build around 540 (higher is better).

For Sunspider 0.9.1, the numbers are 8890 ms for Rhino 1.7R3, 2250 ms for Rhino master, 2180 ms for rhino_1_8 branch, and 1390 ms for Spidermonkey (this is milliseconds so lower is better).

All Rhino benchmarks are on Oracle JDK 1.7.0 with the server VM and default settings and after a few rounds of warmup. With recent Rhino snapshots you can easily run the benchmarks yourself using the ant benchmark-* targets. My Spidermonkey build is a few months old snapshot built with standard instructions.

like image 189
Hannes Wallnöfer Avatar answered Sep 24 '22 05:09

Hannes Wallnöfer


I don't know of any benchmarks comparing the two, but in my experience SpiderMonkey has been faster. If performance is the only consideration I'd go with that since V8 isn't an option.

I use Rhino though (actually RingoJS, which is based on Rhino and includes a CommonJS implementation and quite a few useful libraries), since it's fast enough and has (again, in my experience) a more mature set of libraries/frameworks available. It can also interface directly with Java libraries so there's a huge amount of code available.

You also mentioned scalability, and Rhino might actually have an edge there because it has decent support for multithreading. Ringo implements a slightly enhanced web worker API.

I don't know of any multithreading libraries for SpiderMonkey but they may exist.

like image 41
Matthew Crumley Avatar answered Sep 22 '22 05:09

Matthew Crumley