Skip to content

Allow one layer of unbalanced conditionals to be inlined - #23721

Closed
limepoutine wants to merge 1 commit into
dlang:masterfrom
limepoutine:inliner-branch
Closed

Allow one layer of unbalanced conditionals to be inlined#23721
limepoutine wants to merge 1 commit into
dlang:masterfrom
limepoutine:inliner-branch

Conversation

@limepoutine

Copy link
Copy Markdown
Contributor

This PR enables functions with one layer of unbalanced if statements to be inlined. I want to see if there is performance benefit.

// Before inlining
if (cond)
    return exp1;
...
return exp2;

// After inlining
if (cond)
    return exp1;
else
{
    ...
    return exp2;
}

@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown

DMD perf check

Metric Base PR Δ
hello binary size (stripped) 0.72 MB 0.72 MB -0.54%
All measurements
Metric Base PR Δ
compile hello.d (instr) 214.9 M 214.9 M +0.001%
compile hello.d -O -release (instr) 233.2 M 233.2 M +0.001%
compile Phobos (instr) 5,123.6 M 5,123.6 M 0.000%
compile Phobos codegen (instr) 1,472.7 M 1,472.7 M -0.001%
compile vibe.d (instr) 15,130.4 M 15,130.5 M +0.001%
dmd binary size (stripped) 6.86 MB 6.86 MB 0.00%
hello binary size (stripped) 0.72 MB 0.72 MB -0.54%
peak RSS (compile hello.d) 43.41 MB 43.43 MB +0.05%
peak RSS (compile Phobos) 618.1 MB 617.6 MB -0.07%
peak RSS (compile vibe.d) 1917 MB 1918 MB +0.01%
compile dmd itself (wall) 12.2 s 12.2 s -0.66%
compile hello.d (wall) 63.0 ms 63.0 ms +0.04%
compile Phobos (wall) 1,546 ms 1,540 ms -0.40%

3ce32e4 vs merge-base b41cb91 · about these metrics

@limepoutine

Copy link
Copy Markdown
Contributor Author

Tiny performance benefits. It might help more to remove other inlining blockers.

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