Length Checking, y in x or y.length=x?

Benchmark created by imsky on


Preparation HTML

<script>
  var a = [];
  a[1000] = "sparse";
  a[9000] = "arrays";
  a[1000000] = "are";
  a[9999999] = "cool";
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
y in x
9999998 in a;
ready
x.length === y
a.length === 9999998;
ready
x.length == y
a.length == 9999998;
ready

Revisions

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