split vs splice

JavaScript performance comparison

Test case created by stuartm

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  let str = 'lavfi.astats.2.Peak_level=-22.714214';
  let result = '';

};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
Split
result = str.split('=')[1];
pending…
Slice
result = str.slice(26);
pending…
Slice of unknown length
result = str.slice(str.indexOf('='));
pending…
Substring
result = str.substring(26);
pending…
Substring of unknown length
result = str.substring(str.indexOf('='));
pending…

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

Compare results of other browsers

0 Comments