Hi everyone,

https://github.com/emscripten-core/emscripten/pull/16011

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.

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/CAEX4NpRcTrORmEQOQKLOT%3DGnPBoZU6KpcBtApsk4wSegVaNF1A%40mail.gmail.com.

Reply via email to