-
Notifications
You must be signed in to change notification settings - Fork 1
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 performance boost on V8 #16
Comments
@Ap0ph1s the thing is that we do not control v8. The V8 is developed by Google corporation and they define the way it goes. |
V8 already does a very good job with code written to asm.js without having specific asm.js hacks. I'd argue that the HUGE performance boost for V8 is overly optimistic. |
As far as I understand it, asm.js just adds static typing. Instead of doing that, v8 and seamonkey guess the type and insert cheap runtime checks to ensure that. Thus, asm.js doesn't give any measurable performance benefits if you repeatedly run the same code (provided that the code in question is written with care about performance). Anyway, node.js core doesn't do any heavy computations, so it doesn't matter here. You could ask people who write native crc32 modules for example, they could say something meaningful about it. |
As an author of some native crypto stuff, I'd say that asm.js is less needed than some |
afaik Spidermonkey / FF does better optimizations on asm.js code sometimes. I also think using non-native-js libraries is silly. |
Just fyi, some speed comparisons of bcrypt implemented in C, js and -Tim Fedor Indutny schreef op 22-11-14 om 16:05:
|
Just FYI, next chrome will enable turbofan-asm. https://codereview.chromium.org/770203003/ |
@indutny is it worth to re-implement/transpile to asm.js anything that currently is c/c++ ? |
@YuriSolovyov what exactly do you want to transpile? There is only two IO-independent C++ism here: cryptography and http parser. Cryptography in JS is possible and might be fast, but still it'll be slower and less secure (at least because it'll need to be reimplemented in JS). HTTP parser is completely different story. Ideally, we could rewrite it in javascript or transpile it to JS, but I have never seen an implementation that is capable of same-speed parsing and provides same strictness as joyent/http-parser. |
@indutny for http parser, if you just transpile it to asm.js from existing C/C++ code, how can you loose any strictness? I think it should be the same parser, but without going to C++ land. For crypto, I agree. asm.js is not that good for now, nor V8 asm.js compiler. In general, this is what google trying to do with chrome: they had problems with DOM bindings being in C++ and they trying to cross C++/JS boundaries less often by staying in JS as much as possible, so I thought it may be applicable to this case as well. |
@YuriSolovyov it would be interesting to see how well it'll perform after transpiling. Sounds like an interesting experiment ;) Do you want to help us with this? |
@indutny the only plan I have is
If I fail at any step, I have no idea where to dig, as I not familiar with both node core and C++. |
@YuriSolovyov sounds like a good plan :) |
@YuriSolovyov and please don't forget to share results ;) |
@indutny 2 news: Good and Bad.
Latest stable Firefox
This all can possibly be optimized better, but a I don't have good enough knowledge to do better. This is all done by following tutorials. ( still pretty cool though :) ) I'm glad if it is interesting to anyone. |
@YuriSolovyov Thanks for these experiments. Do you know how it compares to https://github.com/creationix/http-parser-js ? |
@LaurentVB https://github.com/creationix/http-parser-js will probably be faster, because it does not have all that asm.js machinery, but I'm not 100% sure. |
also, here is archive with transpiled http parser. |
For the sake of curiosity, I tried the same benchmark (js port here) on https://github.com/creationix/http-parser-js.
Not there yet... |
@LaurentVB , so which one is slower? Is |
Just curious if it is possible to port C parser to js just by hand, using plain js. |
I think so. Those |
@rlidwka Yes, on my machine and under node 0.10, the js version of |
Will asm.js be used in V8 to optimize its performance? If asm.js is used, that will be a HUGE performance boost for V8 and essentially node.js.
The text was updated successfully, but these errors were encountered: