Skip to content

Build: Switch from frontend-PGO to IR-PGO - #23870

Draft
kinke wants to merge 1 commit into
dlang:masterfrom
kinke:pgo_ir_based
Draft

kinke wants to merge 1 commit into
dlang:masterfrom
kinke:pgo_ir_based

Conversation

@kinke

@kinke kinke commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

I.e., from LDC's own AST-based implementation (-fprofile-instr-…) to LLVM-builtin IR-based PGO (-fprofile-…). With the downside of having to enable optimizations for the instrumented compiler (=> longer build time).

@github-actions

github-actions Bot commented Sep 17, 2026

Copy link
Copy Markdown

DMD perf check

Metric Base PR Δ
compile hello.d (instr) 213.0 M 211.6 M -0.690%
compile hello.d -O -release (instr) 231.1 M 229.1 M -0.827%
compile Phobos (instr) 5,081.2 M 4,902.5 M -3.519%
compile Phobos codegen (instr) 1,442.3 M 1,429.4 M -0.896%
compile vibe.d (instr) 15,019.2 M 14,494.2 M -3.495%
dmd binary size (stripped) 6.91 MB 8.13 MB +17.76%
peak RSS (compile hello.d) 43.29 MB 44.26 MB +2.26%
Breakdown — compile hello.d
Phase (wall, self time) Base PR Δ
sema1 10.2 ms 9.3 ms -8.84%
sema_other 14.2 ms 13.6 ms -4.47%
sema3 5.9 ms 5.3 ms -10.43%
parse 31.9 ms 31.4 ms -1.58%
codegen 2.0 ms 1.9 ms -3.92%
Breakdown — compile Phobos

-178.8 M instructions: frontend -165.9 M (-4.56%), codegen -12.9 M (-0.90%)

Phase (wall, self time) Base PR Δ
sema3 607 ms 533 ms -12.21%
sema1 224 ms 203 ms -9.17%
codegen 401 ms 386 ms -3.69%
sema_other 206 ms 194 ms -5.87%
parse 110 ms 106 ms -3.85%
ctfe 14.2 ms 11.5 ms -18.81%
sema2 1.5 ms 0.8 ms -44.64%
inline 4.3 ms 4.4 ms +2.99%
All measurements
Metric Base PR Δ
compile hello.d (instr) 213.0 M 211.6 M -0.690%
compile hello.d -O -release (instr) 231.1 M 229.1 M -0.827%
compile Phobos (instr) 5,081.2 M 4,902.5 M -3.519%
compile Phobos codegen (instr) 1,442.3 M 1,429.4 M -0.896%
compile vibe.d (instr) 15,019.2 M 14,494.2 M -3.495%
dmd binary size (stripped) 6.91 MB 8.13 MB +17.76%
hello binary size (stripped) 0.72 MB 0.72 MB 0.00%
peak RSS (compile hello.d) 43.29 MB 44.26 MB +2.26%
peak RSS (compile Phobos) 620.2 MB 616.1 MB -0.65%
peak RSS (compile vibe.d) 1916 MB 1908 MB -0.43%
compile dmd itself (wall) 12.1 s 12.1 s +0.08%
compile hello.d (wall) 64.2 ms 61.5 ms -4.26%
compile Phobos (wall) 1,568 ms 1,439 ms -8.23%

2c9ff5f vs merge-base 278dce2 · about these metrics

I.e., from LDC's own AST-based implementation (-fprofile-instr-…) to
LLVM-builtin IR-based PGO (-fprofile-…). With the downside of having
to enable optimizations for the instrumented compiler (=> longer
build time).
@kinke

kinke commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

Oh wow, pretty significant change in metrics! Note that due to optimizing the instrumented compiler, the runtime of the perf CI job (to gather the performance metrics) would be prolonged by ~2.5 minutes. At least according to https://github.com/dlang/dmd/actions/runs/35171311430/job/105043379050?pr=23870, where the non-optimized build for master took 13 secs, and the optimized one 1:27 mins.

FYI @abulgit @0xEAB (testing this on Windows would be nice :])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant