Math.floor speed

Benchmark created on


Setup

var roundMe = Math.random() * 500;

Test runner

Ready to run.

Testing in
TestOps/sec
Math.floor
var rounded = Math.floor(roundMe);
ready
Bit shift
var rounded = roundMe << 0;
ready
Double NOT
var rounded = ~~roundMe;
ready
AND
var rounded = roundMe & roundMe;
ready
OR
var rounded = roundMe | roundMe;
ready
parseInt
var rounded = parseInt(roundMe);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.