The emscripten build flags look good, no obvious problem there. Yeah, JS profiling is the next thing to look at. On the emscripten side, use --profiling to generate the build. Once you have those builds, if you can put them up I'd be interested to run the profiler myself too.
On Sat, Sep 10, 2016 at 1:06 PM, Aviad Lahav <aviad.la...@gmail.com> wrote: > Regarding the build: I was testing libsodium-js build from npm ( > https://www.npmjs.com/package/libsodium). This package is wrapping > libsodium's own emscripten build script (https://github.com/jedisct1/ > libsodium/blob/master/dist-build/emscripten.sh). Essentially following > https://github.com/jedisct1/libsodium.js#custom-build will reproduce the > build. > > The algorithm seems quite similar in both, using a montgomery ladder with > 32-bit ints as the limbs (basic units) of the bigints involved. > Tweetnacl is generally based on this paper: https://tweetnacl.cr. > yp.to/tweetnacl-20140917.pdf (esp. the section "Arithmetic modulo the > group order"). > > > I'll try to see what the JS profiler says in the next couple of days; I'll > need to to build a custom, non-uglified variant to see anything meaningful. > > Anything else I can add? > > p.s. I remember having seen a great performance gap between libsodium's > native crypto_pwhash() and the emscripten build. It's been some time ago so > I don't remember the exact details, but it was around one or two orders of > magnitude of a gap. > > > > > On Sat, Sep 10, 2016 at 6:43 PM, Alon Zakai <alonza...@gmail.com> wrote: > >> That is surprising, yes. >> >> Are they implementing the exact same algorithm? >> >> Are there full instructions to build both projects? Or builds online? >> Might be something in the emcc command for example (like building without >> opts). >> >> Running a JS profiler might show something interesting. >> >> On Fri, Sep 9, 2016 at 9:38 PM, John Doughnut <aviadla...@gmail.com> >> wrote: >> >>> I was comparing standard JS implementation ( >>> https://github.com/dchest/tweetnacl-js) and emscripten-built crypto >>> library. >>> >>> I was surprised to find that the standard JS implementation was markedly >>> faster than asm.js-assisted implementation. >>> >>> Can someone point to the root cause of this gap / am I missing something? >>> >>> Results: >>> Chrome 52: >>> >>> => 108 >>> => 990 >>> >>> FF 48: >>> => 472 >>> => 1939 >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "emscripten-discuss" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to emscripten-discuss+unsubscr...@googlegroups.com. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "emscripten-discuss" group. >> To unsubscribe from this topic, visit https://groups.google.com/d/to >> pic/emscripten-discuss/Z5HJM99I934/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> emscripten-discuss+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to emscripten-discuss+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.