Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Round vs Others
(version: 1)
Comparing performance of:
trunc vs floor vs parseInt vs bitwise invert2 vs bitwise or
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
var num = Math.random() * 100;
Tests:
trunc
Math.trunc(num);
floor
Math.floor(num);
parseInt
parseInt(num);
bitwise invert2
~~(num);
bitwise or
num | 0
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (5)
Previous results
Fork
Test case name
Result
trunc
floor
parseInt
bitwise invert2
bitwise or
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36 Edg/133.0.0.0
Browser/OS:
Chrome 133 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
trunc
193958032.0 Ops/sec
floor
223372624.0 Ops/sec
parseInt
146112960.0 Ops/sec
bitwise invert2
219538912.0 Ops/sec
bitwise or
203104176.0 Ops/sec
Related benchmarks:
Bitwise floor
Math.floor vs Math.trunc
parseInt vs Math.trunc
Trunc vs Floor vs ParseInt vs ~~
parseInt vs Math.trunc 2
Truncate
trunc vs floor
Bitwise vs modulo (2)
Round vs Others2
Comments
Confirm delete:
Do you really want to delete benchmark?