Skip to content

Add precompiled header for kernel libraries (~11.85% faster build)#612

Open
Omotola wants to merge 1 commit into
RenderKit:masterfrom
Omotola:perf/kernels-pch
Open

Add precompiled header for kernel libraries (~11.85% faster build)#612
Omotola wants to merge 1 commit into
RenderKit:masterfrom
Omotola:perf/kernels-pch

Conversation

@Omotola

@Omotola Omotola commented Jul 22, 2026

Copy link
Copy Markdown

Summary

Adds a precompiled header (PCH) for the Embree kernel libraries to reduce build time.

Motivation

kernels/common/default.h is included by nearly every kernel translation unit and transitively pulls in platform.h, intrinsics.h, thread.h, mutex.h, windows.h and heavy STL headers (e.g. <memory>). Parsing it once per translation unit is a significant, repeated cost.

Change

Use target_precompile_headers() to precompile default.h once per ISA target (embree, embree_sse42/avx/avx2/avx512). Each target builds its own PCH with that target's flags.

Measured impact

Full clean rebuild, MSVC, Release, 5 runs each:

Variant Mean (s) StdDev (s)
baseline 1898.5 17.05
post (PCH) 1673.5 17.45

~225 s faster (11.85%).

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

Profiling with vcperf showed kernels/common/default.h is the most
expensive included header, parsed in every kernel translation unit and
transitively pulling in platform.h, intrinsics.h, windows.h and heavy STL
headers. Precompile it once per ISA target via target_precompile_headers.

Measured on a full clean rebuild (5 runs each, MSVC, Release):
  baseline: 1898.5s (sd 17.05)
  post PCH: 1673.5s (sd 17.45)  ->  11.85% faster

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 78e85f7d-912f-4a77-9a1c-3c4f0316d659
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant