#14214: Cythoned homsets
----------------------------------------------+-----------------------------
Reporter: SimonKing | Owner: tbd
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-5.9
Component: performance | Resolution:
Keywords: Hom, cython, cached method | Work issues: Do not change
cmp too much
Report Upstream: N/A | Reviewers:
Authors: Simon King | Merged in:
Dependencies: #14159, #12951, #13184 | Stopgaps:
----------------------------------------------+-----------------------------
Comment (by SimonKing):
Replying to [comment:22 SimonKing]:
> Right, there is the `__cached_methods` attribute. This could be used to
store that values. Would be slower than calling a cached method without
arguments, though.
No, it is more tricky. If you have a class that allows attribute
assignment, then `__cached_method` is indeed not used. But if you have a
class that does not allow attribute assignment, then `__cached_method` is
used to hold the cached method caller itself (i.e., it does not contain
the cache but the cached method).
What do you think of doing the following in `__init__`:
{{{
#!python
try:
self._domain = D
except AttributeError:
self.__cached_method['_domain'] = D
}}}
This would be enough to provide _domain as an attribute. For speed
reasons, it might still be a good idea to have a cached method `domain()`.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14214#comment:23>
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.