Run details:
Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:106.0) Gecko/20100101 Firefox/106.0
Firefox 106
Windows 7
Desktop
2 years ago
Test name Executions per second
split + join 1496000.0 Ops/sec
replace 1420015.9 Ops/sec
Script Preparation code:
AخA
 
var example = 'AgreementChangeId'
Tests:
  • split + join

     
    var result = example.split(/(?=[A-Z])/).join(' ');
  • replace

     
    var result = example.replace(/([A-Z]+)/g, ' $1')