diff options
author | Joseph Huber <huberjn@outlook.com> | 2025-07-23 13:19:43 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-23 13:19:43 -0500 |
commit | ce52f9cdc4c6873d1d5b3a970393d4b6aff12e70 (patch) | |
tree | 368211515b335ba996dded5b8f09fb09a528c87c /clang/lib/Lex/ModuleMapFile.cpp | |
parent | df1dd803b6a1b1dd514da5e7c1257c0b75592452 (diff) | |
download | llvm-ce52f9cdc4c6873d1d5b3a970393d4b6aff12e70.zip llvm-ce52f9cdc4c6873d1d5b3a970393d4b6aff12e70.tar.gz llvm-ce52f9cdc4c6873d1d5b3a970393d4b6aff12e70.tar.bz2 |
[libc] Search empty bits after failed allocation (#149910)
Summary:
The scheme we use to find a free bit is to just do a random walk. This
works very well up until you start to completely saturate the bitfield.
Because the result of the fetch_or yields the previous value, we can
search this to go to any known empty bits as our next guess. This
effectively increases our liklihood of finding a match after two tries
by 32x since the distribution is random.
This *massively* improves performance when a lot of memory is allocated
without freeing, as it now doesn't takea one in a million shot to fill
that last bit. A further change could improve this further by only
*mostly* filling the slab, allowing 1% to be free at all times.
Diffstat (limited to 'clang/lib/Lex/ModuleMapFile.cpp')
0 files changed, 0 insertions, 0 deletions