JIT – Enable, Disable or Depends?

Hi,

Just wanna share some quick benchmark on Mozilla’s JS engines. So today I’ve 2 version of SpiderMonkey:

  1. JavaScript-C 1.8.0 pre-release 1 2009-02-16
  2. JavaScript-C 1.8.5+ 2011-04-16 (build with JIT method enabled)

Today’s benchmark script is…. the sudoku_v2 from Attractive Chaos. Get it here:

git clone https://github.com/attractivechaos/plb.git

Now lets start with JavaScript-C 1.8.0 pre-release 1 2009-02-16

cd plb/sudoku/
 
time js-apt sudoku_v2.js < sudoku.txt > /dev/null 
 
real	0m5.635s
user	0m5.572s
sys	0m0.024s

Hurm… Okay!

Lets move on to the to JavaScript-C 1.8.5+ 2011-04-16 with -m option (Enable the JaegerMonkey method JIT) and -a option (Do not try to run in the interpreter before method jitting)

time js-jit -m -a sudoku_v2.js < sudoku.txt > /dev/null 
 
real	0m0.778s
user	0m0.736s
sys	0m0.044s

Impressive… Lets enable type inference using -n option

time js-jit -m -a -n sudoku_v2.js < sudoku.txt > /dev/null 
 
real	0m0.649s
user	0m0.576s
sys	0m0.060s

Ok.. As expected… :) But for some reason, -n option works better without -a option.. So lets see:

time js-jit -m -n sudoku_v2.js < sudoku.txt > /dev/null 
 
real	0m0.601s
user	0m0.556s
sys	0m0.048s

So as for a quick conclusion based on today’s benchmark, enabling JIT make your JavaScript execution faster.

Thanks ;)
 

P/S:

Personally I’ve work on a project with the integration of SpiderMonkey and some python stuff, and I’ve found that enabling JIT will not necessarily bring faster execution of your JS. I’ll share the story once the project is ready to be announced :)

No responses yet

Post a comment

Post Your Comment