Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
lodash capitalize vs regex replace
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:124.0) Gecko/20100101 Firefox/124.0
Browser:
Firefox 124
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
Regex replace
42.8 Ops/sec
lodash
133.3 Ops/sec
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.4/lodash.min.js"></script>
Tests:
Regex replace
function capitalize(str) { return str.replace(/(^[a-z]|\s[a-z])/g, text => text.toUpperCase()) } for ( let i = 0; i < 100000; i++) { capitalize('ho hiep 111') }
lodash
for ( let i = 0; i < 100000; i++) { _.capitalize('ho hiep 111') }