Another algo for faster sorting
tsbockman via Digitalmars-d
digitalmars-d at puremagic.com
Fri Apr 8 01:12:29 PDT 2016
On Friday, 8 April 2016 at 07:28:38 UTC, Andrea Fontana wrote:
> I mean to replace sort() on phobos if T == byte || T == ...
I know that's what you meant.
> Ok, but it's not a good reason to keep an inefficient sort() on
> phobos. I would use algorithms in phobos without thinking if I
> have to reimplement them or not.
There are tons of algorithms in Phobos that *could* be made
faster for some combinations of inputs, but it doesn't make sense
to add every possible template specialization because of the
long-term maintenance costs.
My point is that I doubt specializing `sort()` for `bool` and
`byte` is actually worth the costs. That's just my opinion
though, and I could be swayed easily enough given some evidence
of a specific real-world need for the optimization.
In any case, you are free to submit a Phobos pull request if you
think it's worth it.
More information about the Digitalmars-d
mailing list