Please test the new EVAL_CTORS

36 views
Skip to first unread message

Alon Zakai

unread,
Jan 18, 2022, 12:47:36 PM1/18/22
to emscripte...@googlegroups.com
Hi everyone,


has landed, which "reboots" the old EVAL_CTOR option. Until now that option has not been useful since we switched to the wasm backend, for several reasons. But all those issues have now been fixed.

EVAL_CTORS basically tries to compile code at link time. If you have global constructors that do pure computation, or even parts of main(), then doing that work and then "snapshotting" the results (the state of wasm memory and globals) into the wasm can save time during startup. It may also decrease the wasm size, but it may also increase it depending on how many changes to memory the code does.

More concretely, this will try to execute global constructors and main() and it will keep going until it reaches something it can't eval, which is typically a call to an import.

To test it, get the latest tip of tree build

emsdk install tot

and then during link try to add

-s EVAL_CTORS

Some logging will show up saying what it managed to eval, or where it failed. If it managed to eval at least some things then you can see what effect that has on code size and startup speed for your project.

If you try it out, let us know how it goes!

- Alon Zakai

P.S. See more details in that PR if you're curious.
Reply all
Reply to author
Forward
0 new messages