Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libc++] Optimize rotate #120890

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

philnik777
Copy link
Contributor

----------------------------------------------------------
Benchmark                                 old          new
----------------------------------------------------------
BM_std_rotate<int>/1                 0.707 ns      2.83 ns
BM_std_rotate<int>/2                 0.706 ns      2.83 ns
BM_std_rotate<int>/3                  4.93 ns      5.04 ns
BM_std_rotate<int>/4                  5.12 ns      5.14 ns
BM_std_rotate<int>/32                 41.3 ns      16.5 ns
BM_std_rotate<int>/64                 94.1 ns      42.8 ns
BM_std_rotate<int>/512                 764 ns       194 ns
BM_std_rotate<int>/4096               5899 ns      2687 ns
BM_std_rotate<int>/65536             94248 ns     43003 ns
BM_std_rotate<__int128>/1            0.713 ns      2.16 ns
BM_std_rotate<__int128>/2            0.711 ns      2.16 ns
BM_std_rotate<__int128>/3             5.63 ns      5.70 ns
BM_std_rotate<__int128>/4             5.64 ns      5.62 ns
BM_std_rotate<__int128>/32            46.1 ns      29.8 ns
BM_std_rotate<__int128>/64            98.6 ns      75.6 ns
BM_std_rotate<__int128>/512            752 ns       486 ns
BM_std_rotate<__int128>/4096          5849 ns      4913 ns
BM_std_rotate<__int128>/65536        97091 ns     78037 ns
BM_std_rotate<std::string>/1         0.722 ns     0.717 ns
BM_std_rotate<std::string>/2         0.722 ns     0.718 ns
BM_std_rotate<std::string>/3          4.35 ns      4.42 ns
BM_std_rotate<std::string>/4          6.12 ns      6.08 ns
BM_std_rotate<std::string>/32         46.7 ns      46.4 ns
BM_std_rotate<std::string>/64         95.7 ns      94.9 ns
BM_std_rotate<std::string>/512         795 ns       792 ns
BM_std_rotate<std::string>/4096       6500 ns      6442 ns
BM_std_rotate<std::string>/65536    106532 ns    103567 ns

Fixes #54949
Fixes #39644

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[libcxx] std::rotate gcd is 3-10x slower than the forward variant. Benchmarking std::rotate.
1 participant