Math.floor vs Math.round vs parseInt vs Bitwise

JavaScript performance comparison

Revision 94 of this test case created by

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
Math.floor
Math.floor("89.938" / "293.3");
Math.floor("83784" / "9289.2");
Math.floor("7" / "60");
pending…
Math.round
Math.round("89.938" / "293.3");
Math.round("83784" / "9289.2");
Math.round("7" / "60");
pending…
parseInt
parseInt("89.938" / "293.3");
parseInt("83784" / "9289.2");
parseInt("7" / "60");
pending…
Bitwise |
("89.938" / "293.3") | 0;
("83784" / "9289.2") | 0;
("7" / "60") | 0;
pending…
Bitwise
("89.938" / "293.3") >> 0;
("83784" / "9289.2") >> 0;
("7" / "60") >> 0;
pending…
~
~~("89.938" / "293.3");
~~("83784" / "9289.2");
~~("7" / "60");
pending…
Number
Number("89.938" / "293.3");
Number("83784" / "9289.2");
Number("7" / "60");
pending…
Internal Conversion
("89.938" / "293.3");
("83784" / "9289.2");
("7" / "60");
pending…
No Conversion
(89.938 / 293.3);
(83784 / 9289.2);
(7 / 60);
pending…

Compare results of other browsers

Revisions

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

0 Comments