Closed paulshapiro closed 6 years ago
Looks like the answer is to switch to asm.js. Fast load time. No unsafe-eval. Better browser support anyway.
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.
Link-time optimization gives a massive boot (compile) time optimization for both wasm and asm.js builds.
Interesting writeup http://floooh.github.io/2016/08/27/asmjs-diet.html
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:
https://hacks.mozilla.org/2018/01/shrinking-webassembly-and-javascript-code-sizes-in-emscripten/
https://kripken.github.io/emscripten-site/docs/optimizing/Optimizing-Code.html
https://groups.google.com/forum/#!topic/emscripten-discuss/c-qjCLWpAwQ