www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17485] New: bringToFront and/or upperBound slow

https://issues.dlang.org/show_bug.cgi?id=17485

          Issue ID: 17485
           Summary: bringToFront and/or upperBound slow
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: schveiguy yahoo.com

See this thread:
https://forum.dlang.org/post/wfackprjkbyxqheszvvx forum.dlang.org

Not any idea why it doesn't go fast, or his other issue with -boundscheck=off
on ldc, but tinkering with the code, I couldn't get much except:

1. It's not the interaction of SortedRange with bringToFront
2. It's not an issue with using functors instead of lambdas
3. It's not an issue with the initial setup, as that should take nowhere near
the 10 seconds I found it takes (consistent with his testing).
4. It *may* be an issue with the comparison, but I switched away from using ==,
and didn't get any better performance.

Ali's message in the thread may give a clue as to why std::rotate is so good
and something we should try and dissect to copy it's speedups:
https://stackoverflow.com/questions/21160875/why-is-stdrotate-so-fast

--
Jun 09 2017