Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It looks like i've found what is wrong - compilation used in 'my' code (actually taken from internet samples) has nothing to do with 'compiled'. </p> <p>Finally i've got to this link - <a href="https://developer.mozilla.org/en-US/docs/Rhino_JavaScript_Compiler" rel="nofollow">https://developer.mozilla.org/en-US/docs/Rhino_JavaScript_Compiler</a> - the Rhino's tool to compile .js into .class. I've got following result with the same JS code running compiled from .class's bytecode:</p> <pre><code> time: 202ms, chars: 38890, sum: 2046720 time: 92ms, chars: 38890, sum: 2046720 time: 73ms, chars: 38890, sum: 2046720 ... time: 71ms, chars: 38890, sum: 2046720 time: 66ms, chars: 38890, sum: 2046720 time: 64ms, chars: 38890, sum: 2046720 ... 1143ms (per 15 iterations) --- sleep 5 secs --- time: 64ms, chars: 38890, sum: 2046720 time: 52ms, chars: 38890, sum: 2046720 time: 64ms, chars: 38890, sum: 2046720 ... time: 62ms, chars: 38890, sum: 2046720 time: 67ms, chars: 38890, sum: 2046720 time: 67ms, chars: 38890, sum: 2046720 ... 962ms --- sleep 5 secs --- time: 66ms, chars: 38890, sum: 2046720 time: 56ms, chars: 38890, sum: 2046720 time: 59ms, chars: 38890, sum: 2046720 ... time: 69ms, chars: 38890, sum: 2046720 time: 67ms, chars: 38890, sum: 2046720 time: 59ms, chars: 38890, sum: 2046720 ... 966ms </code></pre> <p>(this is roughly 10 time quicker)</p> <p>and this is the result from Chrome:</p> <pre><code> time: 5ms, chars: 38890, sum: 2046720 time: 3ms, chars: 38890, sum: 2046720 time: 1ms, chars: 38890, sum: 2046720 time: 1ms, chars: 38890, sum: 2046720 time: 1ms, chars: 38890, sum: 2046720 time: 5ms, chars: 38890, sum: 2046720 time: 0ms, chars: 38890, sum: 2046720 time: 1ms, chars: 38890, sum: 2046720 time: 1ms, chars: 38890, sum: 2046720 time: 1ms, chars: 38890, sum: 2046720 </code></pre> <p>(average is 3-4 msec, ~15 quicker than compiled Java/Rhino, and ~200 times quicker than interpreted Java/Rhino).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload