This is an archive of the discontinued LLVM Phabricator instance.

[MachO] Reduce size of Symbol and Defined
ClosedPublic

Authored by smeenai on Nov 12 2021, 3:54 PM.

Details

Reviewers
gkm
int3
Group Reviewers
Restricted Project
Commits
rG31952978970d: [MachO] Reduce size of Symbol and Defined
Summary

We can lay out Symbol more optimally to reduce its size from 56 bytes to
48 bytes by eliminating unnecessary padding, and we can lay out Defined
such that its bitfield members are placed in the tail padding of Symbol
(on ABIs which support this), to reduce it from 96 bytes to 80 bytes (8
bytes from the Symbol reduction, and 8 bytes from the tail padding
reuse).

This is perf-neutral for an internal app (results from two different
machines):

           smol-syms       baseline        difference (95% CI)
sys_time   7.430 ± 0.202   7.440 ± 0.193   [  -2.6% ..   +2.9%]
user_time  21.443 ± 0.513  21.206 ± 0.396  [  -3.3% ..   +1.1%]
wall_time  20.453 ± 0.534  20.222 ± 0.488  [  -3.7% ..   +1.5%]
samples    9               8

           smol-syms       baseline        difference (95% CI)
sys_time   3.011 ± 0.050   3.040 ± 0.052   [  -0.4% ..   +2.3%]
user_time  10.416 ± 0.075  10.496 ± 0.091  [  +0.1% ..   +1.4%]
wall_time  12.229 ± 0.144  12.354 ± 0.192  [  -0.1% ..   +2.1%]
samples    14              13

However, on the first machine, it reduces maximum resident set size by
65.9 MB (0.8%, from 7.92 GB to 7.85 GB). On the second machine, it
reduces it by 92 MB (1.4%, from 6.40 GB to 6.31 GB).

Diff Detail

Event Timeline

smeenai created this revision.Nov 12 2021, 3:54 PM
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a reviewer: Restricted Project. · View Herald Transcript
smeenai requested review of this revision.Nov 12 2021, 3:54 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 12 2021, 3:54 PM
smeenai added a subscriber: oontvoo.

This will cause merge conflicts for D113167. I'm happy to wait until that lands, if @oontvoo prefers.

I'll move the asserts to Symbols.cpp if I get positive responses to https://reviews.llvm.org/D113809#3128636.

int3 accepted this revision.Nov 12 2021, 4:32 PM
int3 added a subscriber: int3.

Neat!

This revision is now accepted and ready to land.Nov 12 2021, 4:32 PM

This will cause merge conflicts for D113167. I'm happy to wait until that lands, if @oontvoo prefers.

I'll move the asserts to Symbols.cpp if I get positive responses to https://reviews.llvm.org/D113809#3128636.

Thanks! Does anyone want to LGTM D113167 ? :)

Otherwise, since your patch seems less controversial, feel free to ship it .. I can resolve the conflicts afterwards - didn't seem like a big one (I think)

This will cause merge conflicts for D113167. I'm happy to wait until that lands, if @oontvoo prefers.

I'll move the asserts to Symbols.cpp if I get positive responses to https://reviews.llvm.org/D113809#3128636.

Thanks! Does anyone want to LGTM D113167 ? :)

Otherwise, since your patch seems less controversial, feel free to ship it .. I can resolve the conflicts afterwards - didn't seem like a big one (I think)

I'm not planning to land mine till Monday, and looks like you have your LGTM, so feel free to commit ahead of me.