Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
mustache vs replace
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0
Browser:
Chrome 120
Operating system:
Linux
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
mustache
149071.6 Ops/sec
non mustache
118135.6 Ops/sec
HTML Preparation code:
<script src='https://cdn.jsdelivr.net/combine/npm/mustache@4.0.1,npm/mustache@4.0.1/mustache.min.js'></script>
Tests:
mustache
const messageId = "hello {{planet}} what a {{weather}} day is in {{country}} today!"; const parameters = [{"planet": "earth"}, {"weather": "sunny"}, {"country":"Scotland"}]; console.log(Mustache.render(messageId,parameters));
non mustache
const messageId = "hello {{planet}} what a {{weather}} day is in {{country}} today!"; const parameters = [{"planet": "earth"}, {"weather": "sunny"}, {"country":"Scotland"}]; console.log(messageId ? Object.entries(parameters).reduce( (res, [key, value]) => res.replace(new RegExp(`{{\\s*${key}\\s*}}`, "g"), value), messageId ) : "");