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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
Browser:
Chrome 137
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Benchmark engine:
Benchmark.js
native replace
14.0M/s
lodash trim
9.9M/s
View exact numbers
Test name
Executions per second
✓
native replace
13,956,764 Ops/sec
lodash trim
9,894,861 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, "")