[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC] Implement C++ One Definition Rule for struct, class and union



On 12-11-2019 14:56, Tom de Vries wrote:
> V. Effect
> 
> We use a cc1 executable to generate executables compressed with no odr,
> --odr and --odr-unify:
> ...
> $ dwz -l50000000 cc1 -o 1
> $ dwz -l50000000 cc1 -o 2 --odr
> $ dwz -l50000000 cc1 -o 3 --odr-unify
> ...
> 
> Then we can inspect the differences:
> ...
> $ diff.sh cc1 1
> .debug_info      red: 44.80%    111527248  61570632
> .debug_abbrev    red: 40.16%    1722726  1030935
> .debug_str       red: 0%        6609355  6609355
> total            red: 42.26%    119859329 69210922
> $ diff.sh cc1 2
> .debug_info      red: 55.16%    111527248  50019425
> .debug_abbrev    red: 68.13%    1722726  549035
> .debug_str       red: 0%        6609355  6609355
> total            red: 52.30%    119859329 57177815
> $ diff.sh cc1 3
> .debug_info      red: 58.18%    111527248  46649959
> .debug_abbrev    red: 79.57%    1722726  352080
> .debug_str       red: 0%        6609355  6609355
> total            red: 55.28%    119859329 53611394
> ...
> 
> So, the .debug_info and .debug_abbrev sections are reduced in size by:
> - by 42% when not using odr,
> - by 52% when using --odr, and
> - by 55% when using --odr-unify.
> 
> VI. Cost
> 

> Using the same cc1 example as in V, we can see the cost of the optimization:

At V, I correctly used -l50000000 (l lower-case), but here I accidentally
used -L50000000 (L upper-case).  Which means low-mem mode kicked in and
disabled the optimization midway, so the time and mem results presented here
earlier were off.
Let's try again:
...
$ time.sh dwz -l50000000 cc1 -o 1
maxmem: 1341888
real: 7.09
user: 6.90
system: 0.18
$ time.sh dwz -l50000000 cc1 -o 2 --odr
maxmem: 1336612
real: 18.72
user: 18.54
system: 0.17
$ time.sh dwz -l50000000 cc1 -o 3 --odr-unify
maxmem: 1336216
real: 13.76
user: 13.57
system: 0.18
...

> It's good to note though that without the patch series applied, we use less
> memory, due to the struct dw_die not having the copy/origin fields:

And here again:
...
$ time.sh dwz -lnone cc1 -o 1
maxmem: 1179928
real: 6.98
user: 6.83
system: 0.14
...

Thanks,
- Tom