Math.Floor vs ~~ vs parseInt (v8)

Revision 8 of this benchmark created on


Setup

var pi = 3.14;

Test runner

Ready to run.

Testing in
TestOps/sec
Math.floor
var final = Math.floor(pi);
ready
~~
var final = ~~pi;
ready
parseInt
var final = parseInt(pi);
ready
or
var final = pi | 0;
ready
>>
var final = pi >> 0;
ready
<<
var final = pi << 0;
ready
>>>
var final = pi >>> 0;
ready

Revisions

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