Im working on a Javascript vp8 decoder, need everything to be as fast as possible for safari in this case because webkit browsers are target platform.
Need structure for motion vector. Its pretty much an object with 2 chars:
var test = { x:0, y:1 }
var testArray = new Uint8Array(2);
This
test.x = (test.x | 0 + 1) | 0;
test.y = (test.y | 0 + 1) | 0;
is much faster on safari than this:
testArray[0] = (testArray[0] + 1) | 0;
testArray[1] = (testArray[1] + 1) | 0;
But the opposite on the other browsers.
Why...?
Try the jsperf: https://jsperf.com/obj-vs-struct-7
Edit the pseudo struct is faster on ios, its just the desktop browser.