-
Notifications
You must be signed in to change notification settings - Fork 113
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
Typed Arrays #64
Comments
@backspaces I'm interested in adding support for this but need to see some real usecases first, can you expand a bit more on your description? |
I built a simple REST interface webpage here, open the console to see the Background: our project (http://agentscript.org) is doing large scale We first tried using our standard approach, an Array of Objects. Memory The results were spectacular! It sounds odd as hell, I realize that, but For example, this works fine (make sure console open): http://backspaces.net/temp/memory.html?type=Int8Array&length=1e6&count=1000 But you can see the speed difference too. I know es7 plans to address .. and I just want to thank you for your work, its changed a LOT of our -- Owen On Wed, Oct 29, 2014 at 4:31 AM, Charles Pick [email protected]
|
One more note: after testing this a few times, the team got nuts with -- Owen Simple filling of arrays, one typed, the other not On Wed, Oct 29, 2014 at 12:00 PM, Owen Densmore [email protected] wrote:
|
typed arrays are not always faster than native arrays Here's some benchmarks. firefoxchromesafariThe tests for glMatrix and for twgl. It's possible the tests or the libraries have some other optimizations needed to get typed arrays to beat native but if you check the tests, they generally try to avoid allocation the the libraries themseves, at least twgl and glMatrix are a single line change to allocate native arrays or typed arrays |
Nice, interesting! Space is considerably better with TAs, but nice to see that performance is more subtle. |
Typed arrays have huge memory and cpu advantages over JavaScript Arrays.
Have you considered typed array usage? A project I'm working favors typed arrays over JavaScript arrays. Both for cpu speed and for memory efficiency.
And an extreme case, rather than using an Array of Objects, we use a single Object of Typed Arrays, where each variable in the object corresponds to a Typed Array. So foo[i].var === foo.var[i]. In a sense, it is struct-like.
The text was updated successfully, but these errors were encountered: