Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36
Chrome 114
Mac OS X 10.15.7
Desktop
one year ago
Test name Executions per second
slice 30025872.0 Ops/sec
substr 30133594.0 Ops/sec
substring 29864542.0 Ops/sec
Script Preparation code:
AخA
 
var example = 'there is no spoon'
Tests:
  • slice

     
    var result = example.slice(10)
  • substr

     
    var result = example.substr(10)
  • substring

     
    var result = example.substring(10)