[Issue 17485] bringToFront and/or upperBound slow

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Jun 9 16:30:03 PDT 2017


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

hsteoh at quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hsteoh at quickfur.ath.cx

--- Comment #1 from hsteoh at quickfur.ath.cx ---
>From an initial cursory glance: bringToFrontImpl relies only on forward range
primitives to do its job.  Also, it allows you to transcribe ranges with
different element types across each other (as long as the element type is
implicitly convertible to the target element type).  While this is all great
for generality, it sucks for performance when you're dealing with, e.g.,
built-in arrays.

I think there should definitely be a specialization for built-in arrays at the
very least, if not for slice-assignable random-access ranges in general, when
the element types are identical.  Definitely should consider using memmove() in
these cases to take advantage of years' worth of work C library authors have
put into memmove().

--


More information about the Digitalmars-d-bugs mailing list