Using a simple for loop reading and writing single values from typed arrays vs. normal arrays, the performance difference is staggering. Typed arrays are all about 10X slower than normal arrays. This strange behavior only occurs in Safari (running the very same test in Chrome and Firefox the typed arrays win outright, as they should). See the test page for details and source code: http://jsperf.com/read-write-typed-arrays/2 Reproduced in Safari 5.1, 5.11 and WebKit Nightly Build (Oct 18 2011) on OS X 10.7.2.
<rdar://problem/10335308>
Yeah, we know about this. The problem is essentially that WebKit still uses DOM-based typed arrays, which leads to most of the perf issues we see here (essentially they get the worst performance it is possible to achieve in JSC currently). Fix is non-trivial, but it also won't be the hardest thing in the world to achieve.
Cool, thanks guys. I figured you had to know about it, just didn't see it in Bugzilla :)
I don't see any slowdown in Safari 7.0, has this issue been fixed?
This particular bug is believed to have been fixed in Safari 6. There were many additional optimizations afterwards, including a rewrite that happened recently, after Safari 7.
I can confirm the speed has greatly improved in Safari 6.1 (I don't have 7 yet).
Could you please test with Safari 6.1 and nightly build, as well? http://nightly.webkit.org
In the test under http://jsperf.com/read-write-typed-arrays/2 WebKit Nightly is faster than Safari 7, especially in Uint32Array tests.