#15931: Implement a proper hash function for (combinatorial) free module
elements
-------------------------------------+-------------------------------------
Reporter: nthiery | Owner:
Type: defect | Status: needs_review
Priority: major | Milestone: sage-6.2
Component: linear algebra | Resolution:
Keywords: | Merged in:
Authors: Nicolas M. ThiƩry | Reviewers: Florent Hivert
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/nthiery/ticket/15931 | e8fe5eb8943debdb457c38d3264167d66e7b2b14
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by hivert):
Replying to [comment:4 nthiery]:
> It's almost an order of magnitude faster (more with larger elements),
assuming we often recompute the hash value of elements.
> Do we want to do this?
Since {{{CombinatorialFreeModuleElement}}} are already large objects
dict(index, coeff)) the size of a cached methods without any arguments
seems to be 128 byte on a 64bits machine as of Sage 6.1.1. It probably
could be lowered (Simon: do you have any idea ?). I'm tempted to say: add
the cached method by default.
For the info here are the Cython struct of a {{{CachedMethodNoArgs}}}:
{{{
cdef class CachedFunction(object):
cdef public str __name__
cdef public str __module__
cdef object _argument_fixer
cdef public object _fix_to_pos
cdef public object f
# cache is not always of type "dict"!
cdef public object cache
cdef tuple _default_key
cdef bint is_classmethod
cdef class CachedMethodCallerNoArgs(CachedFunction):
cdef public object _instance
}}}
wouldn't be possible to replace some attributes such as `__name__`,
`__module__` which are seldom used by a slower property ?
--
Ticket URL: <http://trac.sagemath.org/ticket/15931#comment:6>
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.