DMD Performance Regression Publisher [GSoC 2026]
Abul Hossain Khan
abulkhan19175 at gmail.com
Fri Jul 10 16:06:27 UTC 2026
Hi everyone,
Last time we had switched the host compiler from DMD to
ldc2-1.42.0, which gave a nice drop in instruction counts and
compiler size. Since then I finished my semester exams and got
back to the work.
#### PGO
DMD already has a `dmd-pgo` build target that does the full LDC
PGO cycle, So the first approach was just use that from the
workflow for base and head separately. Got that working, but the
training was actually failing silently cause Phobos was building
after `dmd-pgo`, so the instrumented compiler couldn't import
stdlib during training, so it barely trained on anything. Then I
fixed the ordering and it worked!
But then another problem was that it was showing weird result
after that like ~5.5% delta on sizes and also the Instruction
Count was showing weird deltas. That's because base and head were
each training their own PGO profile independently, in parallel,
the merge data comes out slightly different every single run. So
the two sides end up with two different profiles even on
identical source, which shows up as noise in the diff. Fixed it
by training PGO once and reusing that same profile for both
builds. After that It was stable across the runs.
Here's how the numbers moved across every stage so far:
| Metric | DMD host | LDC2 host | LDC2 + PGO |
|--------|----------|-----------|------------|
| compile hello.d (instr) | 422.8 M | 257.6 M | 224.1 M |
| compile hello.d -O (instr) | 445.9 M | 277.9 M | 242.7 M |
| dmd binary size (stripped) | 11.93 MB | 6.96 MB | 6.89 MB |
| hello binary size | 0.72 MB | 0.72 MB | 0.72 MB |
| peak RSS | 56 MB | 50 MB | 50 MB |
#### Fork PRs
The system works fine on my forked repo, but a PR that comes from
a fork repo gets a read-only token, so the comment step would
just fail there.
Did some research and the usual fix for this is to split it into
two workflows -
`perf.yml` - does the build + measure and just uploads the
results as an artifact,
`perf-comment.yml` - runs on `workflow_run` after that finishes,
in the base repo context, so it gets a writable token, downloads
the artifact and posts the comment. It should works fine.
Now the thing is, `workflow_run` only triggers off the copy of
the workflow that's on the default branch. So until this is
merged to `master`, `perf-comment.yml` just never fires, even
though `perf.yml` runs fine and uploads the artifact.
PR link - https://github.com/dlang/dmd/pull/23380
#### What's next:
- After the PR got Reviewed and merged We can add more workloads
into it, and start working on the dashboard
Thanks again to Dennis for the amazing mentorship.
As always, feel free to leave any feedback or suggestions!
More information about the Digitalmars-d
mailing list