#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:         |  e06b947ab12f9f754363847c996b251f5682c125
  Nathann Cohen          |     Stopgaps:
Report Upstream:  N/A    |
         Branch:         |
  u/ncohen/16353         |
   Dependencies:         |
-------------------------+-------------------------------------------------

Comment (by nbruin):

 -1 for feature creep. People use `cached_function/cached_method` to be
 ''fast''. Adding another parameter/filter slows things down.

 -1 for obscuring serious programming logic: in any non-trivial situation,
 you need a strategy to decide which inputs do need caching and which
 don't. The strategy there will need tuning and/or may have to change
 depending on application. Something like that shouldn't be hidden in a
 decorator that you slap on a function. That strategy could probably do a
 much better job if it's properly integrated with the rest of the code, and
 not just has a preview by peeking at the input parameters.

 I think it's a code smell when this seems attractive: some things seem
 worthwhile to cache but generally it's too expensive. The "worthwhile"
 part is coming from your particular application, so THAT is where you
 should cache or probably more appropriately: where you should build a data
 structure that stores the required intermediate results.

--
Ticket URL: <http://trac.sagemath.org/ticket/16353#comment:7>
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