Script Preparation code:
AخA
 
var text = 'Mary has a little lamb '.repeat(20);
Tests:
  • Split String

     
    text.split(' ').map(w => `${w.charAt(0).toUpperCase()}${w.slice(1)}`).join(' ')
  • Regex

     
    text.replace(/^(.)|\s+(.)/g, c => c.toUpperCase())
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Split String
    Regex

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 5 years ago)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36
Chrome 81 on Linux
View result in a separate tab
Test name Executions per second
Split String 94777.9 Ops/sec
Regex 48585.3 Ops/sec