Optimization levels and settings

25 views
Skip to first unread message

Xellos

unread,
Mar 4, 2025, 10:07:30 AMMar 4
to emscripten-discuss
Hello,
where can I find the default values of settings at various optimization levels?

E.g. in settings.js, I can see "ASSERTIONS=1 is the default at -O0", but I can't find any document containing the full list of such defaults. I'd expect it linked from https://emscripten.org/docs/optimizing/Optimizing-Code.html.

Alon Zakai

unread,
Mar 4, 2025, 2:09:23 PMMar 4
to emscripte...@googlegroups.com
settings.js contains the defaults, at the default compilation settings (which is -O0). It should also mention what changes in higher optimization levels. I think most places do, though I see ASSERTIONS lacks a comment saying it is disabled in -O1 and above, which is a bug (I opened https://github.com/emscripten-core/emscripten/pull/23823 for that now).


--
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.
To view this discussion visit https://groups.google.com/d/msgid/emscripten-discuss/860453dc-76f8-40ab-b96c-e25b714821d0n%40googlegroups.com.

Xellos

unread,
Mar 5, 2025, 5:22:53 AMMar 5
to emscripten-discuss
I see. Can I reliably expect that all possible defaults for any setting will be listed in that setting's documentation in settings.js, then? If so, it'd still be good to note that somewhere in documentation to avoid such questions in the future. (I haven't found anyone asking before but maybe there was.)

Besides ASSERTIONS, I can only find such info for TEXTDECODER and a vague "Minification requires at least -O1 or -Os to be used." for MINIFY_HTML, which is much fewer than I'd expect. I'm worried that stuff got omitted.

Alon Zakai

unread,
Mar 5, 2025, 12:30:54 PMMar 5
to emscripte...@googlegroups.com
I don't think many settings should be changing with optimization level - ASSERTIONS is a rare exception. So I am not surprised that there are few.

Sam Clegg

unread,
Mar 5, 2025, 12:43:14 PMMar 5
to emscripte...@googlegroups.com
On Wed, Mar 5, 2025 at 2:22 AM Xellos <jakub...@gmail.com> wrote:
I see. Can I reliably expect that all possible defaults for any setting will be listed in that setting's documentation in settings.js, then? If so, it'd still be good to note that somewhere in documentation to avoid such questions in the future. (I haven't found anyone asking before but maybe there was.)

Besides ASSERTIONS, I can only find such info for TEXTDECODER and a vague "Minification requires at least -O1 or -Os to be used." for MINIFY_HTML, which is much fewer than I'd expect. I'm worried that stuff got omitted.

Yes, I think the settings documentation (settings.js .. and its web visiable verion https://emscripten.org/docs/tools_reference/settings_reference.html) is where this kind of information should be surfaced.

If you find things that are missing or vague please open issues and we can get them fixed.

cheers,
sam




On Tuesday, 4 March 2025 at 20:09:23 UTC+1 alon...@gmail.com wrote:
settings.js contains the defaults, at the default compilation settings (which is -O0). It should also mention what changes in higher optimization levels. I think most places do, though I see ASSERTIONS lacks a comment saying it is disabled in -O1 and above, which is a bug (I opened https://github.com/emscripten-core/emscripten/pull/23823 for that now).


On Tue, Mar 4, 2025 at 7:07 AM Xellos <jakub...@gmail.com> wrote:
Hello,
where can I find the default values of settings at various optimization levels?

E.g. in settings.js, I can see "ASSERTIONS=1 is the default at -O0", but I can't find any document containing the full list of such defaults. I'd expect it linked from https://emscripten.org/docs/optimizing/Optimizing-Code.html.

--
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.
To view this discussion visit https://groups.google.com/d/msgid/emscripten-discuss/860453dc-76f8-40ab-b96c-e25b714821d0n%40googlegroups.com.

--
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.
Reply all
Reply to author
Forward
0 new messages