Hi!

Since quite a long time, #11115 is in need of a review. I think that
it provides quite useful stuff and should thus soon be added to Sage.

Currently, cached_method is implemented in Python, and can be so
frustratingly slow that it is faster to not cache simple routines, or
to implement a cache manually.
With #11115, cached_method is rewritten in Cython and is so fast that
it beats any Python method.

Examples: A Python method
    def is_exact(self):
        return True
needs 690 ns on my machine, and
    def prec(self):
        return self._prec
even takes about 2.1 µs. Prepending @cached_method to these methods
makes them use not more than 375 ns on the same machine

So, cached_method is both comfortable and fast.

Currently, a cached_method (that may be inherited from the category
framework) does not work on instances that do not allow attribute
access (the cache would break). #11115 makes it work on all parents.

Currently, cached_method can not be used at all in Cython code. Now,
it can (with some rough edges), even though a hand-written cache in
Cython is still faster (but less comfortable).

Currently, there is a class ClearCacheOnPickle, that avoids to store
the cached function values when pickling an instance. However, that
class had no example and did actually not work. #11115 provides a
working implementation.

Also, #11115 is currently the only dependency that prevents #11068
from being merged, that adds basic support for one- and two-sided
ideals in non-commutative rings to Sage.

Hence, I'd appreciate a review!

Best regards,
Simon

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to