Bitwise rounding

JavaScript performance comparison

Revision 58 of this test case created by azazdeaz

Info

Rounding with possible bitwise operation.

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var foo1 = 77.4;
    var foo2 = 352164613641.446333;
    var foo3 = 6;
    var foo4 = null;
    var foo5 = "string";
};
</script>

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
OR
foo1 | 0;
foo2 | 0;
foo3 | 0;
foo4 | 0;
foo5 | 0;
pending…
Double NOT
~~foo1;
~~foo2;
~~foo3;
~~foo4;
~~foo5;
pending…
AND
foo1 & foo1;
foo2 & foo2;
foo3 & foo3;
foo4 & foo4;
foo5 & foo5;
pending…
Shift left
foo1 << 0;
foo2 << 0;
foo3 << 0;
foo4 << 0;
foo5 << 0;
pending…
Shift right
foo1 >> 0;
foo2 >> 0;
foo3 >> 0;
foo4 >> 0;
foo5 >> 0;
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. Here’s a list of current revisions for this page:

0 comments

Add a comment