Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Lodash template vs replace
(version: 1)
Comparing performance of:
lodash template vs native replace
Created:
3 months ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.min.js'></script>
Script Preparation code:
const vars = { 'LANG' : 'es' }; const url = 'https://www.test.es/{{LANG}}';
Tests:
lodash template
var LODASH_TEMPLATE_CONFIG = { interpolate: /{{([\w\.]+?)}}/g, escape: null, evaluate: null }; var compiled = _.template(url, LODASH_TEMPLATE_CONFIG); console.log(compiled(vars));
native replace
var result = url.replace('{{LANG}}', vars.LANG); console.log(result);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
lodash template
native replace
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
3 months ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36
Browser/OS:
Chrome 121 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
lodash template
79355.1 Ops/sec
native replace
203841.0 Ops/sec
Related benchmarks:
geaegaegaefeafefafaeafafea
string IndexOf vs string Includes vs lodash includes vs lodash indexOf
Lodash get vs deconstruction
Lodash equal vs native
Lodash isString
lodash get vs es6
Lodash isString fork
lodash has vs object.hasOwn
equals comparison
Comments
Confirm delete:
Do you really want to delete benchmark?