Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
lodash trim vs native replace
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0
Browser:
Firefox 115
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Benchmark engine:
Benchmark.js
native replace
4.3M/s
lodash trim
1.4M/s
View exact numbers
Test name
Executions per second
✓
native replace
4,261,248 Ops/sec
lodash trim
1,437,670 Ops/sec
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash-fp/0.10.4/lodash-fp.js'></script>
Script Preparation code:
var test = ' tom hanks '
Tests:
lodash trim
_.trim(test, ' ,')
native replace
test.replace(/(^[,\s]+)|([,\s]+$)/g, "")