#11794: Optional cythonised cached hash for Python classes
----------------------------------+-----------------------------------------
Reporter: SimonKing | Owner: jason
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-5.0
Component: misc | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: Simon King | Merged in:
Dependencies: #11115, #11791 | Stopgaps:
----------------------------------+-----------------------------------------
Changes (by SimonKing):
* cc: robertwb (added)
Comment:
Replying to [comment:8 hivert]:
> Hi Simon,
>
> Looks like you have done a lot of hard work here ! Thanks ! I might
review it more or less soon.
>
> I've a question: how does it interact with #8119 ? Does it solve the
problem there ?
Now (after a look at Robert's patch from #8119) I understand your
question: Robert suggests to cache the hash value of `CategoryObject`, and
he removes a couple of custom hash methods that actually do nothing but
replicate the default hash method.
Then, I'd say the relation of the two tickets is as follows:
* With Robert's patch, the DEFAULT hash of `CategoryObject` would be
cached. If a sub-class has its own hash method, then this would ''not'' be
automatically cached. And if your sub-class is actually just a Python
class, then its hash would ''not'' be automatically fast.
* With my patch, if you write a Python class with a custom hash method,
then you can additionally provide the new metaclass, and would turn the
slow uncached custom hash into a fast cached custom hash.
I am not sure what would happen in the following situation: Start with a
class C that uses the `FastHash` metaclass. Create a subclass D of C that
has a custom hash. Would the hash of D be automatically fast and cached,
because it derives from a class with the `FastHash` metaclass?
Need to test it - that would be nice to have, I think.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11794#comment:11>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.