#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 ncohen):
> -1 for feature creep. People use `cached_function/cached_method` to be
''fast''. Adding another parameter/filter slows things down.
If there was not a "key" parameter to normalize the input I would have
agreed with that. Please tell me why this feature is needed and "clean"
and not mine. I was looking at it while I wrote this patch, and the cost
of mine is less important.
> -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.
You can define the filter wherever you want, and make it as long and
complicated as you want. And when you have defined it, how do you plan on
making "cached_method" behave according to it except through the decorator
?
> I think it's a code smell when this seems attractive:
Come on guy, caching the output of calls which give a small output does
not seem that far fetched. Why can't you see it ?
> some things seem worthwhile to cache but generally it's too expensive.
Indeed. I want to filter them out.
Nathann
--
Ticket URL: <http://trac.sagemath.org/ticket/16353#comment:8>
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.