next.js
a10d278e - Turbopack: add no-memory flag to NEXT_TURBOPACK_TRACING (#99777)

Commit
2 days ago
Turbopack: add no-memory flag to NEXT_TURBOPACK_TRACING (#99777) ## Summary Adds a `no-memory` flag to `NEXT_TURBOPACK_TRACING`, next to `gz`/`gz-best` (e.g. `NEXT_TURBOPACK_TRACING=1,no-memory`). With the flag, `RawTraceLayer` writes no allocation counters for span enters/exits and no `MemorySample` rows. Without memory data, a trace of `bench/heavy-npm-deps` is about a third of the size. Use it when only timing data matters. - `RawTraceLayerOptions { memory: bool }` (default `true`), with `RawTraceLayer::with_options`. `RawTraceLayer::new` keeps the old behavior. - The flag is documented in `contributing/turbopack/tracing.md`. Part of a stack that reduces the trace file size (#99765 adds the `turbo-trace-size` CLI used for the measurements): 1. #99777: **This PR**: `no-memory` flag 2. #99778: Merge allocation counters into Enter/Exit rows 3. #99779: Delta-encode allocation counters, skip unchanged ones 4. #99780: Omit Exit+Enter pairs with (almost) no gap 5. #99781: Bump the trace header to `TRACEv1` ## Measurements `next build` of `bench/heavy-npm-deps`, release native binding built from source (`image-extended,tracing/release_max_level_trace`): | flags | trace size | | --- | --- | | `1` | 68.2 MiB | | `1,no-memory` | 23.3 MiB | ## Verification - New unit tests in `raw_trace.rs` decode a captured trace (with and without memory tracking) - Captured both traces above with a locally built binding <!-- NEXT_JS_LLM --> <!-- fleet 4a52842b-f1a2-43cb-9779-3655caada6a0 --> Co-authored-by: vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com>
Author
Parents
Loading