improving the join function

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Oct 12 06:55:44 PDT 2010


On 10/11/10 23:00 CDT, Daniel Gibson wrote:
> Of course indexes would speed things up, but as mentioned before join()
> would work ok on almost(*) all ranges (with O(n^2) complexity) and a lot
> better on std.range.SortedRange.
> Because the user would provide a predicate (that should use the same
> comparator that was used to sort the range) no additional structure
> (metadata like needed for natural join) would be needed.
>
> (*) the inner range needs to be a FordwardRange so it can be traversed
> multiple times

 From http://www.hookedonlinq.com/JoinOperator.ashx (see the "loop 
count" section), the way it works is not O(n*n); an index is created 
automatically.

Andrei


More information about the Digitalmars-d mailing list