Script Preparation code:
AخA
 
var string = "I am the god of hellfire, and I bring you..."
Tests:
  • indexOf + slice

     
    var position = string.indexOf(',');
    if (position === -1) position = string.length;
    var substring = string.slice(0, position);
  • split

     
    var substring = string.split(',')[0];
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    indexOf + slice
    split

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36
Chrome 117 on Linux
View result in a separate tab
Test name Executions per second
indexOf + slice 5545892.5 Ops/sec
split 7282972.5 Ops/sec