object-init-vs-string-init

Benchmark created by jfd on


Preparation HTML

<script>
  function Test(i) {
   this.i = i;
  }
  
  var count = 0;
  var test;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
new object
test = new Test(count++);
ready
string
test = "" + (count++);
ready
newstring
test = new String(count++);
ready

Revisions

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