Hi! I was applying my improved version of cached_method to the __hash__ method for number field ideals. The __hash__ method, itself, became much faster:
sage: I = NumberField(x^2 + 1, 'a').ideal(7) sage: %timeit I.__hash__() 625 loops, best of 3: 403 ns per loop which would be 1.09 µs without my patch. However, to my surprise, the time for hash(I) dramatically increases: sage: %timeit hash(I) 625 loops, best of 3: 39.7 µs per loop which would only be 1.26 µs without my patch. Apparently hash(I) is not simply returning I.__hash__(), because we have (with or without my patch) sage: I.__hash__() is I.__hash__() True sage: hash(I) is hash(I) False But how is it possible that hash(I) becomes much slower, even though I.__hash__() becomes much faster? Why is there such an overhead? Is __hash__ supposed to be a "usual" method, not a @cached_method? Best regards, Simon -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org