.length vs !==

Benchmark created by Andreas Goebel on


Description

This testcase compares the performance of the !== operator and the property .length to determine whether a string is empty or not

Preparation HTML

<script>
 var mystring = "foobar";
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
!==
if (mystring !== "") {}
ready
.length
if (mystring.length) {}
ready

Revisions

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

  • Revision 1: published by Andreas Goebel on