Automatic Semicolon Insertion versus Manual Semicolon Insertion (v6)

Revision 6 of this benchmark created by Robert on


Description

The spec doesn't mandate function declaration, while loops, or if statements be terminated with a semicolon (or be made to be terminated), so I've removed those erroneous semicolons.

Test runner

Ready to run.

Testing in
TestOps/sec
asi
function square(number) {
  var result = number * number
  return result
}

var c = 0

while (c < 100) {
  if (typeof c === 'number') {
    square(c)
    c += 1
  }
}
ready
msi
function square(number) {
  var result = number * number;
  return result;
}

var c = 0;

while (c < 100) {
  if (typeof c === 'number') {
    square(c);
    c += 1;
  }
}
ready
asi-minified
function square(a){return a*a}for(var c=0;100>c;)"number"===typeof c&&(square(c),c+=1)
ready
msi-minified
function square(a){return a*a;}for(var c=0;100>c;)"number"===typeof c&&(square(c),c+=1);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.

  • Revision 1: published by Heath Matlock on
  • Revision 4: published by Callum Macrae on
  • Revision 6: published by Robert on
  • Revision 7: published on