Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
floor vs trunc vs bit shift
the fastest way to get an integer from a float
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:135.0) Gecko/20100101 Firefox/135.0
Browser:
Firefox 135
Operating system:
Ubuntu
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
floor
1017464256.0 Ops/sec
trunc
1030661632.0 Ops/sec
bitshift
1023328960.0 Ops/sec
Script Preparation code:
var x = 23.45
Tests:
floor
var r = Math.floor(x)
trunc
var r = Math.trunc(x)
bitshift
var r = x >> 0