Improve incremental compile speed on windows #221

Open
opened 2026-04-05 16:19:08 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @yw4z on 3/21/2026

3 changes made. all made with claude suggestions and many build tests
reduces incremental compile times by 20-30 secs. very noticeable on compiles with small changes

Less pressure on memory

# -Zm520 fixes error C3859 but forces the compiler to pre-allocate that memory for every translation unit regardless
# combining /Zi with /FS frees up a significant amount of memory pressure across all parallel compile jobs and makes /MP faster overall.
    add_compile_options(-bigobj /Zi /FS)

Improved linker performance

# Prevent linker restart when TBB (or other deps) built with /GL are linked
# Make your full (clean) build slower because it enables link-time code generation across all translation units.
# helps incremental builds by preventing the double-link restart from TBB
    set(CMAKE_EXE_LINKER_FLAGS    "${CMAKE_EXE_LINKER_FLAGS} /LTCG")
    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LTCG")

console already suggests using this
> tbbmalloc.lib(frontend.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance

Instant encoding check

Encoding checks now works instant on windows. previous code process each file separately. .this one process all in batch

this change almost saves about 30sec for incremental builds

code stays in this section for a long time on windows. even there are no change on code

Build started at 19:48...
1>------ Build started: Project: encoding-check-libslic3r, Configuration: Release x64 ------
2>------ Build started: Project: encoding-check-libslic3r_gui, Configuration: Release x64 ------

before
Screenshot-20260322042039

after - checks still works
Screenshot-20260322043124

*Originally created by @yw4z on 3/21/2026* 3 changes made. all made with claude suggestions and many build tests reduces incremental compile times by 20-30 secs. very noticeable on compiles with small changes ## Less pressure on memory ``` # -Zm520 fixes error C3859 but forces the compiler to pre-allocate that memory for every translation unit regardless # combining /Zi with /FS frees up a significant amount of memory pressure across all parallel compile jobs and makes /MP faster overall. add_compile_options(-bigobj /Zi /FS) ``` ## Improved linker performance ``` # Prevent linker restart when TBB (or other deps) built with /GL are linked # Make your full (clean) build slower because it enables link-time code generation across all translation units. # helps incremental builds by preventing the double-link restart from TBB set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LTCG") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LTCG") ``` console already suggests using this `> tbbmalloc.lib(frontend.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance` ## Instant encoding check Encoding checks now works instant on windows. previous code process each file separately. .this one process all in batch this change almost saves about 30sec for incremental builds code stays in this section for a long time on windows. even there are no change on code ``` Build started at 19:48... 1>------ Build started: Project: encoding-check-libslic3r, Configuration: Release x64 ------ 2>------ Build started: Project: encoding-check-libslic3r_gui, Configuration: Release x64 ------ ``` before <img width="617" height="48" alt="Screenshot-20260322042039" src="https://github.com/user-attachments/assets/f63a74af-bc72-4dfa-957c-6f8b1c626e7d" /> after - checks still works <img width="1050" height="58" alt="Screenshot-20260322043124" src="https://github.com/user-attachments/assets/2ce9af78-eacd-422c-9e97-04cab16c7832" />
MrUnknownDE added the QoL label 2026-04-05 16:19:08 +02:00
Sign in to join this conversation.
No Label QoL
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/OrcaSlicer#221