This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Make pmr::monotonic_buffer_resource bump down
ClosedPublic

Authored by philnik on Jan 10 2023, 2:22 PM.

Details

Summary

Bumping down is significantly faster than bumping up. This is ABI breaking, but the ABI of pmr::monotonic_buffer_resource was only stabilized in this release cycle, so we can still change it.
For a more detailed explanation why bumping down is better, see https://fitzgeraldnick.com/2019/11/01/always-bump-downwards.html.

Diff Detail

Event Timeline

philnik created this revision.Jan 10 2023, 2:22 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 10 2023, 2:22 PM
philnik requested review of this revision.Jan 10 2023, 2:22 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 10 2023, 2:22 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript

Benchmarks:

--------------------------------
Benchmark          old       new
--------------------------------
bm_list/1      5.93 ns   4.05 ns
bm_list/8      46.8 ns   33.2 ns
bm_list/64      366 ns    240 ns
bm_list/512    3011 ns   1938 ns
bm_list/2048  14374 ns   8517 ns
philnik updated this revision to Diff 487995.Jan 10 2023, 2:25 PM

Remove debug stuff

philnik updated this revision to Diff 488186.Jan 11 2023, 6:26 AM

Try to fix CI

philnik edited the summary of this revision. (Show Details)Jan 11 2023, 6:35 AM
philnik updated this revision to Diff 488225.Jan 11 2023, 7:58 AM

Try to fix CI

ldionne accepted this revision.Jan 12 2023, 8:17 AM
ldionne added inline comments.
libcxx/benchmarks/CMakeLists.txt
180

Can you add a link to the article (https://fitzgeraldnick.com/2019/11/01/always-bump-downwards.html) in the commit message?

This revision is now accepted and ready to land.Jan 12 2023, 8:17 AM
philnik edited the summary of this revision. (Show Details)Jan 12 2023, 9:36 AM
This revision was landed with ongoing or failed builds.Jan 12 2023, 9:36 AM
This revision was automatically updated to reflect the committed changes.
philnik marked an inline comment as done.
Mordante added inline comments.Jan 13 2023, 8:53 AM
libcxx/benchmarks/CMakeLists.txt
180

I would love to see this link in the code too, that makes it a lot easier to find the design rationale than in the commit message.