-
Notifications
You must be signed in to change notification settings - Fork 31
Reduce CppInterOp Emscripten shared library size #655
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
base: main
Are you sure you want to change the base?
Reduce CppInterOp Emscripten shared library size #655
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #655 +/- ##
=======================================
Coverage 79.18% 79.18%
=======================================
Files 9 9
Lines 3853 3853
=======================================
Hits 3051 3051
Misses 802 802 🚀 New features to boost your workflow:
|
It's a compile time optimization flag I think. Do we need to force it like this everywhere or can we have cmake handle this ? |
It is both a link and compile time optimisation. See https://emscripten.org/docs/tools_reference/emcc.html#emcc-oz . |
ee75d01
to
d9f6630
Compare
Yeah but we still don't want users to look into/pass flags correct during the build correct? We should be able to have cmake handle this. |
I really don't understand the point your trying to make. Using EMCC_CFLAGS in this way to perfectly legitimate way of doing the Emscripten build. Emscripten is designed to be effected by modifying this flag (see https://emscripten.org/docs/tools_reference/emcc.html#environment-variables). If a user changes what we have in the documentation for this flag, and messes something up, then that is on them. I don't understand how putting it in a cmake option changes that. |
My point is simple. We already have compile time and link time flags being passed through cmake, I don't see a need to pass this externally. |
I think what @anutosh491 means is that we need to make this flag as part of our default compiler flags in the CMakeLists.txt. |
@vgvassilev @anutosh491 I first tried locally using |
Putting a note here in case I forget. Using EMCC_CFLAGS="-flto" in the llvm build doesn't end up effecting the shared library size on its own. Used in conjuncation with Oz then the size falls slightly to 45/46 Mb. |
db280e0
to
de7101c
Compare
I have updated this PR to use the flto flag as well, and to compile+link CppInterOp shared library with these flags too. This reduces the shared library size to 44/45 Mb. |
Description
Please include a summary of changes, motivation and context for this PR.
@vgvassilev This change locally reduced the Emscripten shared library size to 47/48 Mb (depends of whether you use dir -lh or du -lh). It still passed all tests and xeus-cpp still could run all the notebook cells it could before (exception throwing is broken in CppInterOps deployment at the moment for some reason). I have cleared the cache of all llvm 20 Emscripten builds for this PR.
Fixes # (issue)
Type of change
Please tick all options which are relevant.
Testing
Please describe the test(s) that you added and ran to verify your changes.
Checklist