Open jrmuizel opened 11 years ago
FWIW, making the change from boolean arrays to byte arrays manually improves the performance of NSieve converted to js by about 30%
Good idea. I think I'd need to introduce a Boolean() cast when reading out of the array...
Can you provide the code to nsieve? Can't find it.
Interestingly, I fiddled with this a bit, and while it produces a speedup in spidermonkey it doesn't make a difference at all in V8. I think V8 must have a trick where an Array of Booleans gets the same representation as Uint8Array.
This seems to address things for the basic test case I created; hard to be sure because suddenly both test cases got faster - I guess suddenly SpiderMonkey understood the type information better.
Bleahhhhhhhh. V8 bug: https://code.google.com/p/chromium/issues/detail?id=287773 Spidermonkey bug to do better without the Uint8Array optimization: https://bugzilla.mozilla.org/show_bug.cgi?id=913892
This would help save memory