[Issue 15401] partialSort should accept two ranges

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Dec 9 05:44:17 PST 2015


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

--- Comment #4 from Andrei Alexandrescu <andrei at erdani.com> ---
(In reply to Infiltrator from comment #3)
> (In reply to Andrei Alexandrescu from comment #2)
> > (In reply to Infiltrator from comment #1)
> > > Once issue 15421 is fixed, this is a simple matter of
> > >     topN(l, r);
> > >     sort(l);
> > > 
> > > Which brings us to the question of: should partialSort(Range, index) be
> > > changed to call partialSort(r[0..n], r[n..$]) to reduce duplication or is
> > > there a large performance difference in the two topNs?
> > 
> > Affirmative.
> 
> Sorry, do you mean affirmative to how to implement partialSort(Range, Range);
> or affirmative to changing partialSort(Range, index) to call the (Range,
> Range) version;
> or affirmative to there being too large of a performance difference between
> the two versions of topN?

My bad, I missed the "or". I don't think there's a loss of efficiency if
partialSort with index calls partialSort with the two subranges.

--


More information about the Digitalmars-d-bugs mailing list