replace vs substring for hash

Benchmark created by Jacob Covington on


Preparation HTML

<script>
  var hash = window.location.hash;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Replace
var test = hash.replace('#', '');
ready
Substring
var test = hash.substring(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 Jacob Covington on