diff options
author | Leon Krause <lk@leonkrause.com> | 2018-01-07 00:13:04 +0100 |
---|---|---|
committer | Leon Krause <lk@leonkrause.com> | 2018-01-07 17:43:06 +0100 |
commit | 4211e4453e79d884188d314416fa95693a3678d9 (patch) | |
tree | 0699564545e3fc4c5a4917b06310853cca3ea0c8 | |
parent | 4c23f94af954ede476f1a503e97bfaa0e3dde499 (diff) |
Build WebAssembly module with -Os to decrease file size
-rw-r--r-- | platform/javascript/detect.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py index 8472c3ccab..8c7a904bca 100644 --- a/platform/javascript/detect.py +++ b/platform/javascript/detect.py @@ -49,8 +49,14 @@ def configure(env): ## Build type if (env["target"] == "release"): - env.Append(CCFLAGS=['-O3']) - env.Append(LINKFLAGS=['-O3']) + # Use -Os to prioritize optimizing for reduced file size. This is + # particularly valuable for the web platform because it directly + # decreases download time. + # -Os reduces file size by around 5 MiB over -O3. -Oz only saves about + # 100 KiB over -Os, which does not justify the negative impact on + # run-time performance. + env.Append(CCFLAGS=['-Os']) + env.Append(LINKFLAGS=['-Os']) elif (env["target"] == "release_debug"): env.Append(CCFLAGS=['-O2', '-DDEBUG_ENABLED']) |