[libcxx-commits] [PATCH] D124122: [libc++] Optimize std::rotate
    Nikolas Klauser via Phabricator via libcxx-commits 
    libcxx-commits at lists.llvm.org
       
    Sat Apr 23 11:45:04 PDT 2022
    
    
  
philnik added a comment.
It looks like it is indeed a bit faster for structs that are expensive to move. I'll enable the optimization for non-trivially_move_constructible types and ones that are larger than 32 bytes.
  ------------------------------------------------------------------
  Benchmark                                    old Time     new Time
  ------------------------------------------------------------------
  BM_Rotate_ExpensiveToMove_Random_1            10.4 ns      10.5 ns
  BM_Rotate_ExpensiveToMove_Random_4             300 ns       301 ns
  BM_Rotate_ExpensiveToMove_Random_16           1299 ns      1363 ns
  BM_Rotate_ExpensiveToMove_Random_64           5401 ns      6023 ns
  BM_Rotate_ExpensiveToMove_Random_256         21964 ns     24717 ns
  BM_Rotate_ExpensiveToMove_Random_1024        89849 ns    101480 ns
  BM_Rotate_ExpensiveToMove_Random_16384     1550789 ns   1732624 ns
  BM_Rotate_ExpensiveToMove_Random_262144   30205994 ns  35608461 ns
@var-const The non-trivially-copyable part should be covered by string, or did you have something more specific in mind?
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124122/new/
https://reviews.llvm.org/D124122
    
    
More information about the libcxx-commits
mailing list