-
Notifications
You must be signed in to change notification settings - Fork 58
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
Build not fully optimized? #3
Comments
Oh wait, is this using emscripten with the LLVM wasm backend, and not fastcomp/asm2wasm? Seems so from the list of repos in build.py. If so, then the 15-20% size difference is not that surprising, as the wasm backend tends to emit larger code. Might be worth adding a build step to run binaryen's optimizer, then. |
Yes.
Sounds good. |
If using CMake and e.g. |
Here's what it currently uses:
|
It's now down to 43M. |
I'm a little confused by @juj: @tbfleming Is cmake issuing the final emcc command to link and generate the executable? I don't see an emcc command in the build script, so it seems like that's the case, but if I understand you @juj that shouldn't be possible?
Oh, do you have an error message or stack trace from that? |
Yes. Here's the commands which create the app. I'm running it through release to give you a log.
|
Oops. Sorry; I remembered wrong. It builds but hits this at runtime:
|
1: That 2: Is the relevant CMakeLists.txt this one? https://github.com/tbfleming/cib/blob/master/src/CMakeLists.txt#L105 If so then it looks like cmake is picking the
|
1: I'll try it I forgot to remove the This reminds me of an issue: |
emscripten-core/emscripten#5986 fixed the
Step 3 is because the builds sometimes produce around 130,000 data segments, which exceed Firefox's and Chrome's 100,000 limit. I combine them into a single segment. |
Is that stdio issue fixed by emscripten-core/emscripten#6038 ? About wasm having a 100,000 segment limitation, I wasn't aware of that limit. @lukewagner , is that a temporary thing, or should binaryen work around it? |
emscripten-core/emscripten#6038 fixed it. |
It's a permanent limit and should be the same across browsers since it is in the list of constant limits. If there was a hard reason to relax it, it could be relaxed. |
Ok, thanks for the info, I'll handle it in binaryen. |
@tbfleming WebAssembly/binaryen#1350 should work around the 100K segment limit, please verify it works if you can. |
@kripken that fixed it. Nice branch name :) |
clang.wasm is 54315717 bytes. Running binaryen's
wasm-opt -O2
shrinks it by around 15%, and-Os
by 20%, which suggests maybe it wasn't fully optimized?I see the build script uses cmake and sets it to release, which should optimize the object files, but I'm not sure how it handles the final link to wasm (in emcc, we need
-Os
or such during both compile and link). @juj, I think you wrote the emcmake code, what does it do for the final link?cc @mbebenita
The text was updated successfully, but these errors were encountered: