Hi Nicolas!
On 28 Jan., 11:41, "Nicolas M. Thiery" <[email protected]>
wrote:
> Oh wow, I had completely missed all the activity on #8611!
Yes, indeed I think that most (all?) issues that are mentioned in this
thread are actually solved in #8611.
> Out of curiosity: does #8611 keep backward compatibility for the cache
> of old pickles?
Yes. The approach is like this (for cached_method, but
cached_in_parent_method is similar):
If you have
class FOO:
@cached_method
def bar(self,*args,**kwds):
return something
and x = FOO() then calling x.bar() creates an argument x._cache__bar,
which is a dictionary storing the computed values of x.bar(). That's
the same with or without #8611
The news is:
* x.bar is now THE SAME instance each time you call it. I know that it
used to be different, and that was one of the reasons for it being so
slow.
* Since x.bar is permanently there, it makes sense to have x.bar.cache
as well.
"As well" means:
* If x._cache__bar was successfully created then x.bar.cache simply is
a shortpath (from the point of view of the cached method) to access
the cache -- that's another reason why #8611 provides a speed-up.
* x.bar.cache is simply a second pointer to x._cache__bar. In
particular, old pickles (which store x._cache__bar) won't break (I
just tested).
* If x._cache__bar can't be created (AttributeError), then still
x.bar.cache is there, and caching is now possible in some cases where
it would have failed.
I think that's the answer for now. But I think I will go through your
above comments and show how it is addressed by #8611.
Cheers,
Simon
--
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org