-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Use musl implementation of strftime rather than custom JS code. NFC #21379
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
Conversation
05d82fe
to
af4c482
Compare
af4c482
to
51aabcd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree that likely in real-world cases this shrinks code size, and is a very nice simplification.
Agreed, I think this is worth it. |
I had some second thoughts here because I discovered that C++ (specifically C++ i/o streams) end up depending on strftime. So this could effect more programs that I initially expected. |
1e707e3
to
0292054
Compare
This leads to some code size savings in several tests, reduces the differences between standalone mode and non-standalone mode and reduces the amount of custom JS code we need to maitain. In simple microbenchmark that does nothing but export `strftime` we do code size win at `-O0` but a regression in codesize at `-O2`: ``` $ wc -c old_O0.* 74026 old.js 12124 old.wasm 86150 total $ wc -c new_O0.* 62120 new.js 22852 new.wasm 84972 total ``` ``` $ wc -c old_O2.* 8492 old.js 194 old.wasm 8686 total $ wc -c new_O2.* 5040 new.js 14291 new.wasm 19331 total ``` This regression comes from the fact that `snprintf` is used in the implementation of `strftime` and its hard to optimize away the cost of that function. In practice I suspect that any application large enough to call `strftime` is likely already directly or indirectly pulling in `snprintf` so I would hope that this will be codesize win in practice since it removes about 3k of JS.
- Patch missing __secs_to_zone, due to emscripten-core/emscripten#21379 - Better fix for tuklib_integer.cmake usage error in liblzma when compiling with emscripten - Fix lzma test failure
- Patch missing __secs_to_zone, due to emscripten-core/emscripten#21379 - Better fix for tuklib_integer.cmake usage error in liblzma when compiling with emscripten - Fix lzma test failure
This was broken in emscripten-core#21379. Replaces: emscripten-core#22276
This was broken in emscripten-core#21379. Replaces: emscripten-core#22276
This was broken in emscripten-core#21379. Replaces: emscripten-core#22276
This leads to some code size savings in several tests, reduces the differences between standalone mode and non-standalone mode and reduces the amount of custom JS code we need to maitain.
In simple microbenchmark that does nothing but export
strftime
we do code size win at-O0
but a regression in codesize at-O2
:This regression comes from the fact that
snprintf
is used in the implementation ofstrftime
and its hard to optimize away the cost of that function.In practice I suspect that any application large enough to call
strftime
is likely already directly or indirectly pulling insnprintf
so I would hope that this will be codesize win in practice since it removes about 3k of JS.