[all-commits] [llvm/llvm-project] 20f39b: Lower std::string's alignment requirement from 16 ...

Eric via All-commits all-commits at lists.llvm.org
Fri Oct 13 08:56:38 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 20f39bf48218515e05126d02f26cec73ac655b0f
      https://github.com/llvm/llvm-project/commit/20f39bf48218515e05126d02f26cec73ac655b0f
  Author: Eric <eric at efcs.ca>
  Date:   2023-10-13 (Fri, 13 Oct 2023)

  Changed paths:
    M libcxx/docs/ReleaseNotes/18.rst
    M libcxx/include/__config
    M libcxx/include/string
    A libcxx/test/libcxx/strings/basic.string/string.capacity/allocation_size.pass.cpp
    M libcxx/test/libcxx/strings/basic.string/string.capacity/max_size.pass.cpp

  Log Message:
  -----------
  Lower std::string's alignment requirement from 16 to 8. (#68807)

This allows smaller allocations to occur, closer to the actual
std::string's required size. This is particularly effective in
decreasing the allocation size upon initial construction (where
__recommend is called to determine the size).

Although the memory savings per-string are never more than 8 bytes per
string initially, this quickly adds up. And has lead to not insigficant
memory savings at Google.

Unfortunately, this change is ABI breaking because it changes the value
returned by max_size. So it has to be guarded.




More information about the All-commits mailing list