[libcxx-commits] [PATCH] D128146: [libc++] Use uninitialized algorithms for vector

David Blaikie via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 4 12:35:39 PDT 2022


dblaikie added inline comments.


================
Comment at: libcxx/include/__memory/uninitialized_algorithms.h:634
+  } else {
+    return std::move(__first1, __last1, __first2);
+  }
----------------
Ah, this is another source of debug info growth - the `std::move(iter, iter, iter)` implementation instantiates `std::pair` (so this change added an extra 2,000 instantiations of `std::pair` to a clang dbg build - and `std::pair` isn't especially light weight with the compressed pair types, all the members, etc.

Any chance the implementation of `std::move` could be changed to avoid using `std::pair` - while I realize that might involve some code duplication if the underlying helpers are used in a few places that want both parts of the paired result, it might still be worthwhile.

I'll look into making a prototype.

Oh, I didn't send this, and did the prototype... so results: It looks like the `__move_impl` doesn't actually use the pair result at all (the ranges-based move does use it, but the code isn't shared - maybe it was at some point) so I removed it, and that got the total `.dwp` change for this uninitialized patch + that move(iter, iter) patch be slightly negative:
```
    FILE SIZE        VM SIZE
 --------------  --------------
  +0.2%  +571Ki  [ = ]       0    .debug_str.dwo
  +0.2% +26.3Ki  [ = ]       0    .debug_rnglists.dwo
  +0.0% +15.5Ki  [ = ]       0    .debug_str_offsets.dwo
  +0.3% +1.67Ki  [ = ]       0    .debug_loclists.dwo
  -0.2% -17.0Ki  [ = ]       0    .debug_abbrev.dwo
  -0.2%  -697Ki  [ = ]       0    .debug_info.dwo
  -0.0% -99.5Ki  [ = ]       0    TOTAL
```

Net reduction of about 2k std::pair instantiations, rather than a net increase of about 2k with only the uninitialized patch.

though `__compressed_pair`/`__compressed_pair_elem` instances didn't change by much - *shrug*. 25% (3k down from 4k) fewer `make_pair` instantiations. Few other minor things of note.

the increases in `construct` (5933 -> 6229) and `reverse_iterator` (7827 -> 8786) are probably somewhat unavoidable/expected. (well, I understand the construct ones - oh, the reverse iterator ones might be for the destruction codepath that this patch mentions is a bugfix/intentionally added)

I'll send out the __move pair removal cleanup shortly.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128146



More information about the libcxx-commits mailing list