align allocations according to the actual type alignment, not an unconditional 16 - #23557
align allocations according to the actual type alignment, not an unconditional 16#23557rainers wants to merge 6 commits into
Conversation
DMD perf check
|
0bd05c6 to
ca4ddd0
Compare
|
@thewilsonator Please wait with merging. I will investigate whether the measured 1% compile time increase is legit. If it is it might not be worth the memory savings of less than 2% (the overall memory includes the backend that uses about 30% of process memory in my tests). |
173578e to
978a0da
Compare
|
I cannot reproduce locally as results on a mobile processor tend to vary pretty much. From the last test here, the performance drop seems to come from the virtual call of TypeInfo.talign() to get the proper alignment. Unfortunately I've been falling into the trap that TypeInfo_Class.talign() does not provide the alignment of the instance, but only the reference. The instance alignment is nowhere to be found in the TypeInfo. So for instances of new SomeClass, an alignment of 8 is assumed now. This keeps the memory savings, but also provides slightly better performance (~1%). |
978a0da to
4da91c3
Compare
|
ping when this is good |
Unfortunately on posix, real.alignof is 16, and that's used in RealExp and ComplexExp. So I added a register function for large alignments. Let's see how this performs. |
060d9a8 to
0315149
Compare
0315149 to
303e051
Compare
ad21c14 to
dcb61d6
Compare
a5d0ee8 to
28ac80d
Compare
|
This no longer tries to guess the alignment from the TypeInfo, but uses #23595 if the host compiler supports it. Otherwise the default alignment of 16 is used. Expression.copy() and Type.copy() still can take advantage of lower alignment as it is passed to allocmemoryNoFree directly. That doesn't account for much memory savings, though.
@thewilsonator Given that the measured compilation times are reduced by more than 1% this is ready for another review. Merging should probably better wait until after #23595. |
In my phobos-build-all-unittest this saves about 4% of memory of what the the front end needs.
AFAICT alignment deviates from
size_t.sizeofonly forIntegerExpwhen building for 32-bit, though.