Bug 70687
Summary: | Typed arrays are 10X slower than normal classic arrays | ||
---|---|---|---|
Product: | WebKit | Reporter: | Joseph Huckaby <jhuckaby> |
Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | Minor | CC: | ap, cmarcelo, fpizlo, ggaren, m.goleb+bugzilla, oliver, shezbaig.wk |
Priority: | P3 | Keywords: | InRadar |
Version: | 528+ (Nightly build) | ||
Hardware: | Mac (Intel) | ||
OS: | OS X 10.7 | ||
URL: | http://jsperf.com/read-write-typed-arrays/2 |
Joseph Huckaby
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.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Geoffrey Garen
<rdar://problem/10335308>
Oliver Hunt
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.
Joseph Huckaby
Cool, thanks guys. I figured you had to know about it, just didn't see it in Bugzilla :)
Michał Gołębiowski-Owczarek
I don't see any slowdown in Safari 7.0, has this issue been fixed?
Alexey Proskuryakov
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.
Joseph Huckaby
I can confirm the speed has greatly improved in Safari 6.1 (I don't have 7 yet).
Alexey Proskuryakov
Could you please test with Safari 6.1 and nightly build, as well?
http://nightly.webkit.org
Michał Gołębiowski-Owczarek
In the test under http://jsperf.com/read-write-typed-arrays/2 WebKit Nightly is faster than Safari 7, especially in Uint32Array tests.