-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Investigate Dataview usage for typed arrays == 2 #36
Comments
hmmm... still not implemented in Firefox |
I don't think it's implemented in Safari or Opera either. But in any case it would be interesting to do a benchmark to see if this is indeed fast. And if so, adding code to Emscripten to support it as an option would not be hard. I wonder though if it will be. These are function calls, not indexings, which is a different kind of optimization for JS engines, that I suspect they don't do as well on. Making this fast isn't normal function call inlining either, it's inlining of native code into JS. I don't think any JS engine does that (things like PyPy do, though). Also, there is the Binary Data proposal for JS, which would provide something similar to this. Firefox for example is starting to implement it. So it's not clear to me what the future of binary data access is, at the moment... |
I did a test in v8, was a little (few %) bit slower than array + bitshifting. |
…ixes Port Emscripten fixes
If you use DataView, you are no longer required to divide the pointers (or bitshifting) with some constant but rather use [dataview].getInt32, getFloat64 and setInt32 etc. An other bonus is that you can support int8, int16, uints, float32 etc. and can provide better compability.
The question is of course of it is as fast as an array index at this moment, but likely will be in the future.
The text was updated successfully, but these errors were encountered: