js2coffee for loop vs vanilla

JavaScript performance comparison

Test case created by phillips1012

Info

js2coffee seems to turn normal for loops into while loops, which is something you need to watch out for. Here's a comparison between 3 different coffeescript loop methods.

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Vanilla JS for loop
for (var i = 0; i < 10; i++) {}
pending…
Above code translated with js2coffee and back
var i = 0;

while (i < 10) {
  i++;
}

/*
  i = 0
 
  while i < 10
      i++
*/
pending…
for i in [1..100]
var n, _i;

for (n = _i = 1; _i <= 100; n = ++_i) {}

/*
  for i in [1..100]
      ;
*/
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment