something with packing ints

JavaScript performance comparison

Test case created by Arnor

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var pack = function(x,y) { return x | y << 16; }
   
};
</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
looking up an object hash
var newVar = {x: 1337, y: 1337};

var x = newVar.x,
    y = newVar.y;
pending…
packing an int and reading it
var newVar = pack(1337, 1337);

var x = newVar & 0xffff,
    y = ((newVar & 0xffff0000) >>> 16);
pending…

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

Compare results of other browsers

0 comments

Add a comment