Script Preparation code:
AخA
 
var testString = new Array(1000).fill(0).map(() => Math.random().toFixed(4)).join("\n");
Tests:
  • Splitting

     
    testString.split("\n").forEach(v => {
      const f = parseFloat(v);
      if (!window.screen) console.log(f);
    });
  • Regex

    x
     
    var regex = /([^\n]+)\n/g
    while (true) {
      const match = regex.exec(testString);
      if (!match) break;
      const f = parseFloat(match[1]);
      if (!window.screen) console.log(f);
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Splitting
    Regex

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 3 years ago)
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0
Firefox 91 on Ubuntu
View result in a separate tab
Test name Executions per second
Splitting 4362.2 Ops/sec
Regex 3232.0 Ops/sec