emscripten-core / emscripten-core/emscripten

The fastest link time

Open
#18,129 13 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

emcc 3.1.16
According to https://emscripten.org/docs/optimizing/Optimizing-Code.html
docs doesn't clearly point out the pack of compilation flags for acquiring the fastest possible build time

Current flags are:
On debug and release:
```
set(COMMON_CXX)
set(COMMON_LNK
"-s ENVIRONMENT=web"
"-s WASM"
"-s MODULARIZE"
"-s ERROR_ON_MISSING_LIBRARIES"
"-s ERROR_ON_UNDEFINED_SYMBOLS"
"-s NO_FILESYSTEM"
"-s EXPORTED_RUNTIME_METHODS=['cwrap']"
"-s EXPORTED_FUNCTIONS=\"['_malloc', '_free']\""
"-s NO_USE_WEBGL2"
"-s NO_FULL_ES3"
"-s ALLOW_MEMORY_GROWTH"
)
```
On debug only:
```
set(COMMON_DEBUG_CXX
"-O0"
)
set(COMMON_DEBUG_LNK
"-O0"
"-s ASSERTIONS=1"
"-s DEMANGLE_SUPPORT"
"-s RUNTIME_LOGGING"
"-s INITIAL_MEMORY=512MB"
"-s MAXIMUM_MEMORY=4096MB"
)
```

For alternative debug for the fastest debuggable build (still way slower than standalone):
```
set(DEBUGFAST_CXX ${COMMON_DEBUG_CXX}
"-g1"
)
set(DEBUGFAST_LNK ${COMMON_DEBUG_LNK}
"-g1"
"-s ERROR_ON_WASM_CHANGES_AFTER_LINK"
"-s WASM_BIGINT"
)
```

For DWARF build (breakpoint primarily):
```
set(DEBUG_CXX ${COMMON_DEBUG_CXX}
"-g3"
"-fsanitize=undefined"
)
set(DEBUG_LNK ${COMMON_DEBUG_LNK}
"-g3"
"-fsanitize=undefined"
)
```

And still it costs me several minutes to link on debug configuration which is wild and undebaggable.
Am I doing this right?
Any solution to make it faster?
Can switching the whole debug build to the dynamic linking make a time from build to launch faster?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.