Im working on a Javascript vp8 decoder, everything needs to be as fast as possible for safari in this case, because web browser browsers are the target platform.
A structure is required for the motion vector. Its pretty much an object with 2 characters:
var test = { x:0, y:1 }
var testArray = new Uint8Array(2);
it
test.x = (test.x | 0 + 1) | 0;
test.y = (test.y | 0 + 1) | 0;
much faster on safari than this:
testArray[0] = (testArray[0] + 1) | 0;
testArray[1] = (testArray[1] + 1) | 0;
But vice versa in other browsers.
Why...?
Try jsperf:
https://jsperf.com/obj-vs-struct-7
Change pseudo-structure faster on ios, it's just a desktop browser.
source
share