mymonero / mymonero-core-js

The JS library containing the Monero crypto plus lightwallet functions behind the official MyMonero apps
BSD 3-Clause "New" or "Revised" License
101 stars 103 forks source link

WebAssembly file optimizations #46

Closed paulshapiro closed 6 years ago

paulshapiro commented 6 years ago

This issue references the modern core, currently being worked on in the branch cpp.

Presently load time of the full set of compiled core C++ is approx 10s (!!) on my dev laptop. Although it sounds worse than it feels, surprisingly, we should try to get that time down to 1s.

I switched from -O3 to -Os on the final build, but haven't done a huge amount to try to optimize the b2 boost build nor openssl build, both of which produce static libs that are consumed by emscripten. Perhaps optimizing the libraries will yield the results we're looking for. We also can probably strip down a few of the actual Boost libraries and OpenSSL features we're currently compiling in.

I'll use this space to gather some resources:

paulshapiro commented 6 years ago

Looks like the answer is to switch to asm.js. Fast load time. No unsafe-eval. Better browser support anyway.

paulshapiro commented 6 years ago

Reopening this, in fact, given asm.js is too slow in execution. Wasm is the way of the future, so I'm trying to figure out how to optimize initial load. Mostly, I think this is going to fall on browser compiler improvements, such as are already coming out. For node.js we can just create C++ / node.js addon.

paulshapiro commented 6 years ago

Link-time optimization gives a massive boot (compile) time optimization for both wasm and asm.js builds.

paulshapiro commented 6 years ago

Interesting writeup http://floooh.github.io/2016/08/27/asmjs-diet.html