#11794: Optional cythonised cached hash for Python classes
---------------------------+------------------------------------------------
   Reporter:  SimonKing    |          Owner:  jason         
       Type:  enhancement  |         Status:  needs_review  
   Priority:  major        |      Milestone:  sage-4.7.2    
  Component:  misc         |       Keywords:                
Work_issues:               |       Upstream:  N/A           
   Reviewer:               |         Author:  Simon King    
     Merged:               |   Dependencies:  #11115, #11791
---------------------------+------------------------------------------------

Comment(by SimonKing):

 Replying to [comment:1 SimonKing]:
 > I'll try to milden the speed regression exposed above. But I think it is
 OK to make it "needs review".

 I have just posted a new patch (also correcting the patch name - please
 disregard the first patch!). It is not only mildening the regression: It
 actually provides a ''general'' speedup!

 {{{
 sage: from sage.misc.fast_hash import FastHashMetaclass
 sage: F = CombinatorialFreeModule(QQ, ['a','b'])
 sage: D = dir(F)
 sage: timeit('for s in D: a = getattr(F,s)', number=10000)
 10000 loops, best of 3: 84.1 µs per loop
 sage: timeit("hash(F)")
 625 loops, best of 3: 1.09 µs per loop
 sage: F.__class__ = FastHashMetaclass(F.__class__)
 sage: timeit('for s in D: a = getattr(F,s)', number=10000)
 10000 loops, best of 3: 64.4 µs per loop
 sage: timeit("hash(F)")
 625 loops, best of 3: 443 ns per loop
 sage: TestSuite(F).run()
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11794#comment:2>
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.

Reply via email to