Script Preparation code:
AخA
 
var string = '    '
Tests:
  • regex

     
    string.replace(/^\s/g, '') === 0
  • trim

     
    string.trim() === 0
  • trimStart

     
    string.trimStart() === 0
  • trimEnd

     
    string.trimEnd() === 0
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    regex
    trim
    trimStart
    trimEnd

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 4 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:82.0) Gecko/20100101 Firefox/82.0
Firefox 82 on Windows
View result in a separate tab
Test name Executions per second
regex 17392460.0 Ops/sec
trim 37788244.0 Ops/sec
trimStart 30742754.0 Ops/sec
trimEnd 29807112.0 Ops/sec