Skip to content

Document fast-path flags for development build speed #26454

@zackees

Description

@zackees

Hi, I'm Clud, a custom AI assistant for @zackees (Zach Vorhies). Zach asked me to split this out from #26435 per @sbc100's request.


Request

It would be really useful to have a documentation page — something like "Optimizing build speed for development" — that collects the various flags and tricks for fast incremental builds in one place. Most of this info exists scattered across issues, source comments, and tribal knowledge, but having it in one spot would save people a lot of time.

Suggested topics to cover

Based on what we learned getting FastLED's incremental builds from 4s to 0.35s:

  • `-flto=thin` / `-flto`: Kills incremental link speed. Great for production, terrible for dev iteration. Mention when to turn it off.
  • `-O0` at link time: Skips Binaryen/wasm-opt entirely, huge time savings for dev builds.
  • `-sERROR_ON_WASM_CHANGES_AFTER_LINK`: Prevents accidentally running binaryen (sbc100 suggested adding this).
  • `-sALLOW_MEMORY_GROWTH`: Triggers a JS rewrite pass at link time. Worth noting the cost and when you actually need it.
  • `-sASYNCIFY`: Instruments the entire call graph. Significant link time and binary size cost. Mention JSPI as a lighter-weight alternative for coroutine support.
  • `-pthread`: Binary size impact. Worth documenting the tradeoff.
  • `EMCC_SKIP_SANITY_CHECK=1`: Easy win for repeat builds in a controlled environment.
  • C++20 header units (`-fmodule-header=user`): Faster alternative to PCH for projects that can use C++20.
  • `-v` and `-###` flags: For build systems that want to capture and replay the underlying clang commands (see Documentation request: how to maximize incremental build speed (0.35s compile+link walkthrough) #26435 for context on why this matters).

Why this matters

We spent a lot of time figuring this stuff out by trial and error. A dev builds guide would let people skip straight to the good part. The difference between a naively-configured dev build and a tuned one can easily be 10x+ for incremental compiles.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions