[llvm-bugs] [Bug 35614] New: std::rotate can be order of magnitude faster, if it can allocate a buffer.

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Dec 10 15:04:14 PST 2017


https://bugs.llvm.org/show_bug.cgi?id=35614

            Bug ID: 35614
           Summary: std::rotate can be order of magnitude faster, if it
                    can allocate a buffer.
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: denis.yaroshevskij at gmail.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

Hi!

For one sided rotation you do optimize for one element on the stack:
https://github.com/llvm-mirror/libcxx/blob/master/include/algorithm#L2435

Actually this is a valid optimization for arbitrary number of elements and it
can give you an order of magnitude speed up.

Here is a very naive implementation with measurements:
http://quick-bench.com/KjyAe88UUBAjSmDAbUsbkt1mLxQ

Is it ok for std::rotate to do this?
I'm happy to create a patch but some guidance on the benchmark and restrictions
would be nice.

Best,
Dennis

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171210/8a50bf3e/attachment.html>


More information about the llvm-bugs mailing list