Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Number vs + vs parseFloat vs Math.Round (round to 2 decimal places)
(version: 1)
Comparing performance of:
Number vs Unary + vs parseFloat vs multiply, math round, divide
Created:
one year ago
by:
Guest
Jump to the latest result
Tests:
Number
const number = Number(Math.random().toFixed(2));
Unary +
const unary = +Math.random().toFixed(2);
parseFloat
const parse = parseFloat(Math.random().toFixed(2));
multiply, math round, divide
const multiply = Math.round(Math.random() * 100) / 100
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
Number
Unary +
parseFloat
multiply, math round, divide
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
4 months ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:146.0) Gecko/20100101 Firefox/146.0
Browser/OS:
Firefox 146 on Mac OS X 10.15
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Number
19280382.0 Ops/sec
Unary +
19470378.0 Ops/sec
parseFloat
19268498.0 Ops/sec
multiply, math round, divide
1619959680.0 Ops/sec
Related benchmarks:
Number vs + vs parseFloat
Floats: toFixed vs toPrecision vs Math.round
parseFloat
toFixed vs toPrecision vs Math.round() - Return number
toFixed vs toPrecision vs Math.round() - Parsed back to number
toFixed vs toPrecision vs Math.round() as float
parse float
Number vs + vs parseFloat + eval
Number vs + vs parseFloat vs Divide
Comments
Confirm delete:
Do you really want to delete benchmark?