#16353: A cached_function with selective memory
-------------------------+-------------------------------------------------
       Reporter:         |        Owner:
  ncohen                 |       Status:  needs_review
           Type:         |    Milestone:  sage-6.3
  enhancement            |   Resolution:
       Priority:  major  |    Merged in:
      Component:         |    Reviewers:
  performance            |  Work issues:
       Keywords:         |       Commit:
        Authors:         |  7eb8f900f1a143c6cc85b9382a365b57a9c42ecc
  Nathann Cohen          |     Stopgaps:
Report Upstream:  N/A    |
         Branch:         |
  u/ncohen/16353         |
   Dependencies:         |
-------------------------+-------------------------------------------------

Comment (by mathzeta2):

 Replying to [comment:25 ncohen]:
 > [snip]... and it can be used to only cache the most useful answers of a
 recursive function.
 >
 How do you tell which values are the most useful? Except no-argument
 functions, I usually don't like the wide spread of cached_method in Sage.
 One caching strategy that I find useful in practice for recursive
 functions is LRU (least recently used) cache. In Python 3 it is implement
 in the functools module:
 https://docs.python.org/3/library/functools.html#functools.lru_cache and
 for Python 2 there are already several implementations, like the backport
 at http://code.activestate.com/recipes/578078-py26-and-py30-backport-of-
 python-33s-lru-cache/.

--
Ticket URL: <http://trac.sagemath.org/ticket/16353#comment:27>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to