There has been a performance regression for module compilation. The PR #5382 added the trace-log feature by default (this line)
Historically high-frequent trace logs have been a performance bottleneck. Some efforts were made to revert that (#4481, #4484, #2758). In #4484 @bnjbvr added this feature flag, claiming perf increment of 32%, whereafter this flag was enabled by default in #5382.
The following numbers are from sampling the app once before and after with the macos instruments profiler.
The module compilation code takes in total 29.5 sec, of that three log functions here take up ~13 secs in total (43% of total).

Disabling trace logs results in total 10.3s, which is roughly ~65% faster.
Branch for this instrumentation can be found here: https://github.com/bytecodealliance/wasmtime/compare/main...TimonPost:wasmtime:timon/make-trace-logs-not-default?expand=1
Feature
We probably want to disable 'trace-log' by default as shown this takes ~60% of the total module compilation. Also we likely want to expose upstream control over this feature.
Benefit
Speeds up compilation by 60% :).
Implementation
- Remove the
trace-log feature from the default features array in codegen.
- Add
trace-log feature to various crates that depend on codegen, and from those crates expose the ability to 'enable' trace logs as opt in.
- Also expose this feature for
wasmtime crate so that we can decide on enabling/disabling logs.
Details
- Macos 13.0.1, Apple M1 Max
- Precompiled Wasm module is roughly 400MB
There has been a performance regression for module compilation. The PR #5382 added the
trace-logfeature by default (this line)Historically high-frequent trace logs have been a performance bottleneck. Some efforts were made to revert that (#4481, #4484, #2758). In #4484 @bnjbvr added this feature flag, claiming perf increment of 32%, whereafter this flag was enabled by default in #5382.
The following numbers are from sampling the app once before and after with the macos instruments profiler.
The module compilation code takes in total 29.5 sec, of that three log functions here take up ~13 secs in total (43% of total).
Disabling trace logs results in total 10.3s, which is roughly ~65% faster.
Branch for this instrumentation can be found here: https://github.com/bytecodealliance/wasmtime/compare/main...TimonPost:wasmtime:timon/make-trace-logs-not-default?expand=1
Feature
We probably want to disable 'trace-log' by default as shown this takes ~60% of the total module compilation. Also we likely want to expose upstream control over this feature.
Benefit
Speeds up compilation by 60% :).
Implementation
trace-logfeature from the default features array incodegen.trace-logfeature to various crates that depend oncodegen, and from those crates expose the ability to 'enable' trace logs as opt in.wasmtimecrate so that we can decide on enabling/disabling logs.Details