#8611: speed up cached_function and cached_method
---------------------------------------+------------------------------------
Reporter: jason | Owner: tbd
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-4.6.1
Component: misc | Keywords: cached method
Author: Jason Grout, Simon King | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
---------------------------------------+------------------------------------
Comment(by SimonKing):
I slightly changed the patch. But the small change has in fact a big
impact:
The method `sage.categories.category.Category.is_subcategory` is used to
test whether something is an object of a given category. Due to the
omnipresence of categories in Sage, this test occurs very often. So, it
should be optimised!
I suggest that `is_subcategory` should be cached. I.e., the new patch
version differs from the old one only in the line "@cached_method" in
front of that method.
I believe that the additional memory consumption is affordable: When
starting Sage, there are precisely 55 categories, so, in the worst case,
caching `is_subcategory` adds 55 cache dictionaries with 55 entries.
The impact on the overall performance is obvious:
On my machine, `sage -tp 4 sage` takes 1721.2 seconds without my patch,
but 1643.8 seconds with my patch.
Hence, the average improvement is about 4.5%.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8611#comment:13>
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.