Skip to content
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

asm.js #24

Open
jeffrose opened this issue Jun 19, 2015 · 4 comments
Open

asm.js #24

jeffrose opened this issue Jun 19, 2015 · 4 comments

Comments

@jeffrose
Copy link

Have you looked into using asm.js for the PRNG algorithms?

http://asmjs.org/

It may take a little refactoring but there is a potential speed boost.

http://jsperf.com/asm-js-rng/6

@davidbau
Copy link
Owner

davidbau commented Jul 4, 2015

Unfortunately, "jsperf is temporarily unavailable" is what we've been getting for a while, and I haven't been able to see the code that you created. Can you write what you had in mind in this issue?

I had been reluctant to depend on typed arrays (for old browser compatibility) but perhaps it's time to start using them if there is a significant speed benefit. I'd be open to patches with benchmarks.

@jeffrose
Copy link
Author

jeffrose commented Jul 4, 2015

It wasn't my jsperf but it showed a comparison of the same algorithm implemented in both asm.js and plain JavaScript. The asm.js version performed better.

It looks like using typed arrays would only exclude IE8 and IE9 unless a Uint8ClampedArrayis used then IE10 would be excluded as well.

http://caniuse.com/#feat=typedarrays

So it's a matter of how important is IE8-9 support to you. If someone needs support for those browser, they could always load a polyfill beforehand.

Typed arrays aside, the use of asm.js would be ignored by browsers that don't support it. That is, the code would just execute like regular JavaScript.

Personally I've never used asm.js in my own development, but it seems like crypto is a decent use case for it.

@CoDEmanX
Copy link

JSPerf seems to work (again), and if I read the results correctly, asm.js outperforms normal JS by factor 10 in Firefox.

@jeffrose
Copy link
Author

It is a pretty significant performance difference.

screen shot 2016-01-14 at 10 55 06 am
screen shot 2016-01-14 at 11 03 44 am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants