reduce size of Array!T from 32 to 16 bytes - #23404
Merged
Merged
Conversation
rainers
force-pushed
the
array_union
branch
3 times, most recently
from
July 16, 2026 20:25
aa6facc to
d00ed6e
Compare
DMD perf check
|
rainers
force-pushed
the
array_union
branch
2 times, most recently
from
July 16, 2026 20:48
dc484ba to
89b9146
Compare
thewilsonator
marked this pull request as draft
July 16, 2026 23:18
rainers
commented
Jul 17, 2026
| // build the template parameters | ||
| Array!(size_t) paramLens; | ||
| paramLens.reserve(td.parameters.length); | ||
| paramLens.setDim(td.parameters.length); |
Member
Author
There was a problem hiding this comment.
This was an actual bug uncovered by this PR, as reserve leaves the array empty in the foreach loop below.
Contributor
|
Is this good to go? |
rainers
marked this pull request as ready for review
July 18, 2026 09:16
thewilsonator
left a comment
Contributor
There was a problem hiding this comment.
Otherwise looks good.
Member
Author
I have restored/updated comments now. Should be fine.
For the mago-extension you can define extern (D) T[] __debugExpanded() { return opSlice(); }to show the array elements in the VS debugger. Ok to add this? Maybe just for version
Changed back to a field, but just |
- allocates a maximum of uint.max entries - overlaps single entry with pointer to array
thewilsonator
approved these changes
Jul 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With my test case of building all phobos unittests with a single invocation (Win64 dmd built with ldc), this reduces the process memory from 18399 MB to 17616 MB, so almost 5% less memory. Note that compiling with -o- uses about 5 GB less memory, so that part is used by the glue layer and backend.
One downside is that the struct is not as digestible in a debugger as before.
The C++ header is not yet adapted, making length a function might be annoying for GDC and LDC.
Let's see what the performance tester reports...