1

I briefly tested these three engines (rhino/spidermonkey/v8) with the following simple program:

function p(n) {
 for (var i = 2;i * i <= n;i++) {
 if (n % i == 0) {
 return false;
 }
 }
 return true;
}
var sum = 0;
for (var k = 2;k < 10000000;k++) {
 if (p(k)) {
 sum++;
 }
}
print(sum);

And get the following results:

$ time rhino -O 9 sample.js
664579
real 0m40.495s
user 0m40.793s
sys 0m0.180s
$ time js sample.js
664579
real 0m9.465s
user 0m9.477s
sys 0m0.000s
$ time d8 sample.js
664579
real 0m8.941s
user 0m8.943s
sys 0m0.000s

While spidermonkey and v8 are generally comparable in speed, rhino takes significantly longer time even with the highest level of optimization. Is anything wrong here?

I've surveyed standard JavaScript benchmarks but most of them run the test in browser. Could anyone please recommend a command-line version to test the core engines?

asked Nov 27, 2015 at 9:09
1
  • Just being curious, have you tried nashorn? It should outperform rhino. Commented Jul 18, 2016 at 21:05

1 Answer 1

5

While spidermonkey and v8 are generally comparable in speed, rhino takes significantly longer time even with the highest level of optimization. Is anything wrong here?

Nothing wrong here. Rhino is just slow, that's it.

I've surveyed standard JavaScript benchmarks but most of them run the test in browser. Could anyone please recommend a command-line version to test the core engines?

Source codes of Sunspider, Kraken and Octane (ex. v8 test suite; it is included in the V8 engine's sources) benchmarks are available, so you can easily perform standalone testing in the command line.

answered Dec 6, 2015 at 6:08
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.