Skip to content

feat(d): Make use of pragma(inline, true) - #1711

Merged
alexcrichton merged 3 commits into
bytecodealliance:mainfrom
QuantumSegfault:dlang-use-inline
Sep 15, 2026
Merged

alexcrichton merged 3 commits into
bytecodealliance:mainfrom
QuantumSegfault:dlang-use-inline

Conversation

@QuantumSegfault

Copy link
Copy Markdown
Contributor

Introduces use of force-inlining across the bindings where valuable to help reduce binary sizes.

When the output of wit-bindgen is compiled as a separate library from the uses (e.g. when using dub with "targetType": "staticLibrary", there ends up being a lot of bloat from tiny wrappers/helpers that LDC avoids inlining, even at -O3. To help fight this, pragma(inline, true) has been added all around where it has helped reduce code size.

In my testing, it takes a minimal component implementing https://github.com/Pumpkin-MC/pumpkin-plugin-wit from nearly 1 MB, down to ~ 575 KiB when compiling with -Oz. This is with the wit-bindgen output being emitted in one static library, and exports in the main compilation. For reference, compiling it all at once without this PR yields a size of 625 KiB. So it helps in both cases.

@QuantumSegfault

Copy link
Copy Markdown
Contributor Author

@alexcrichton

@alexcrichton
alexcrichton added this pull request to the merge queue Sep 15, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Sep 15, 2026
@QuantumSegfault

Copy link
Copy Markdown
Contributor Author

Needs to be requeued. There was a merge conflict.

@alexcrichton
alexcrichton added this pull request to the merge queue Sep 15, 2026
Merged via the queue into bytecodealliance:main with commit ce24346 Sep 15, 2026
29 checks passed
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.

2 participants