Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
meow meow meow meow ,epw
(version: 1)
Compare round lodash function vs javascript native toFixed() function
Comparing performance of:
Round floating number using lodash round function vs Round floating number using toFixed() vs tofixed
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Tests:
Round floating number using lodash round function
for (var i = 0; i < 10; i = i + 0.01) { _.round(i, 2); }
Round floating number using toFixed()
const b = 2; for (var i = 0; i < 10; i = i + 0.01) { const meow = Math.pow(10, b); Math.round(i * meow) / meow }
tofixed
const b = 2; for (var i = 0; i < 10; i = i + 0.01) { parseFloat(i.toFixed(b)) }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Round floating number using lodash round function
Round floating number using toFixed()
tofixed
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Comments
Confirm delete:
Do you really want to delete benchmark?