[PATCH] D91467: ADT: Take small enough, trivially copyable T by value in SmallVector (otherwise, assert)

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 17 21:36:04 PST 2020


dexonsmith added a comment.

In D91467#2401471 <https://reviews.llvm.org/D91467#2401471>, @dexonsmith wrote:

> In D91467#2401127 <https://reviews.llvm.org/D91467#2401127>, @silvas wrote:
>
>> I think we can probably get a good signal from:
>>
>> 1. Clang execution time compiling some cpp file at by-value thresholds of `0`, `1 * sizeof(void*)`, `2 * sizeof(void*)` would be enough to get a signal on whether this is measurable performance wise.
>> 2. Clang binary size for those 3 cases.
>
> That sounds good. I'll throw in a version with no threshold.

Results of `du -k path/to/clang` followed by timing to compile llvm/lib/Target/X86/X86ISelLowering.cpp three times in a row:

  116216	threshold-0/build/bin/clang-12
         30.31 real        29.96 user         0.34 sys
         30.10 real        29.77 user         0.31 sys
         30.48 real        30.15 user         0.32 sys
  116200	threshold-1-ptr/build/bin/clang-12
         30.58 real        30.23 user         0.33 sys
         30.17 real        29.79 user         0.37 sys
         30.28 real        29.94 user         0.33 sys
  116184	threshold-2-ptr/build/bin/clang-12
         30.15 real        29.85 user         0.30 sys
         29.98 real        29.66 user         0.31 sys
         30.02 real        29.70 user         0.32 sys
  116216	threshold-none/build/bin/clang-12
         30.15 real        29.83 user         0.31 sys
         30.16 real        29.82 user         0.34 sys
         30.21 real        29.90 user         0.30 sys

Sizes are all really close, around 116MB. Best of three runs for `user` time seems to favour `2 * sizeof(void *)` very slightly, but I'm not sure it's significant:

- 29.77s: threshold of 0 (never by-value)
- 29.79s: threshold of `sizeof(void*)`
- 29.66s: threshold of `2 * sizeof(void*)`
- 29.82s: no threshold (always by-value when trivially copyable)

Happy to collect more data if that's useful.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91467/new/

https://reviews.llvm.org/D91467



More information about the llvm-commits mailing list