Dieter Maurer wrote:
> Jim Washington wrote at 2007-3-27 08:24 -0400:
>> ...
>> If you see a sort order as one permutation of a list, the factoradic
>> technique provides a key to that permutation.  So, in theory, one would
>> sort the list, and store the factoradic index for that permutation.  The
>> next time the particular sort order is requested, it's a simple matter
>> of unpacking the factoradic. I have not done any tests to see whether
>> unpacking a factoradic is significantly less expensive than re-sorting. 
>> Intuitively, it should be.  In practice, I am not so sure.
> In what way is it different from caching?
> The "packed factoradic" seems like a cache to me.
Hi, Dieter

A factoradic index is representable as a long integer.  Given that
integer and the canonical list, you can regenerate the permutation
represented by that integer.  So, instead of caching the sorted list
itself, you find and keep this integer, which is all the information
needed to algorithmically re-obtain the sorted list.

So, this would be slower than caching, but (I think) faster than re-sorting.

-Jim Washington

Zope3-dev mailing list

Reply via email to