Optimization levels of precompiled libraries

28 views
Skip to first unread message

Peter Nemeth

unread,
Aug 13, 2015, 6:39:57 AM8/13/15
to emscripten-discuss
Hi,

I'm wondering how do you manage precompiled libraries which you don't want to recompile every time, a la emscripten-ports.

My issue is with the optimization levels, more accurately the difference in them. As stated in the docs:

If you compile several files into a single JavaScript output, be sure to specify the same optimization flags when compiling sources into objects, and objects into JavaScript or HTML.

Do you keep several versions with different optimization levels and always choose the appropriate one?

How does it work with emscripten-ports? I don't remember it rebuilding the sources if I change optimization level after the initial build.

Bests, Peter

Alon Zakai

unread,
Aug 13, 2015, 2:35:52 PM8/13/15
to emscripten-discuss
The docs are a little overly cautious. It is safe to build source files with different LLVM optimizations, like some with -O3, some with -O0, -Os, etc.

In general you should build libraries the same as for any other platform. In ports, I think most are -O2 (automatically, you don't need to do anything for them).

--
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 emscripten-disc...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Peter Nemeth

unread,
Aug 14, 2015, 6:51:44 AM8/14/15
to emscripte...@googlegroups.com
Ok, thanks for the clarification.

--
You received this message because you are subscribed to a topic in the Google Groups "emscripten-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/emscripten-discuss/hiDzPfMetps/unsubscribe.
To unsubscribe from this group and all its topics, send an email to emscripten-disc...@googlegroups.com.

Charles Vaughn

unread,
Aug 19, 2015, 10:58:05 PM8/19/15
to emscripten-discuss
Keep in mind that inlining is one area area where it may matter. If you're aggressively shrinking your size, you'll want to disable inlining when you build the external library. I haven't checked, but it may be possible to delay the inlining decision until you compile and link your final output, but I'm not 100% on that.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages