[Glass] There is really no way to have an ordered/sorted collection together with indexes?
Norm Green via Glass
glass at lists.gemtalksystems.com
Mon Aug 7 12:27:56 PDT 2017
Since you are keeping the prices sorted, you can lookup a price in the
sorted list using a binary search. This gives you a worst-case search
of log2(n) +1, which should be pretty fast as long as the price
comparison methods are fast. You should be able to create a subclass of
SortedCollection to do this.
Also keeping 2 collections that each reference the same large set of
objects should not be that expensive in terms of repository size. That
said, I agree that keeping the prices in 1 collection is a cleaner design.
Norm
On 8/7/17 11:23, Mariano Martinez Peck via Glass wrote:
> Hi guys,
>
> I am storing huge lists of "prices". For this, it really helps me to
> store things ordered (by date)...either in an SequenceableCollection
> or a SortedCollection. On the other hand, I do want to use indexes to
> speedup my query to find price for a given date (equality index).
>
> But I have found no way to have them both. The only workaround I found
> is to keep 2 collections for each of these collections, one
> sorted/ordered, and the other one an unordered one for querying via
> index. But this is a pain from "developing" point of view, as well as
> for unnecessary repository growth.
>
> Am I missing something?
>
> Thanks in advance,
>
> --
> Mariano
> http://marianopeck.wordpress.com
>
>
> _______________________________________________
> Glass mailing list
> Glass at lists.gemtalksystems.com
> http://lists.gemtalksystems.com/mailman/listinfo/glass
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20170807/d165a9d0/attachment.html>
More information about the Glass
mailing list