#11402: add a cache on basis in free modules
-----------------------------+----------------------------------------------
Reporter: hivert | Owner: hivert
Type: enhancement | Status: new
Priority: major | Milestone: sage-4.7.1
Component: combinatorics | Keywords: FreeModules basis cache
Work_issues: | Upstream: N/A
Reviewer: | Author: Florent Hivert
Merged: | Dependencies:
-----------------------------+----------------------------------------------
Let {{{FM}}} be a combinatorial free module currently creating elements
using the basis is very slow because the family is recreated each time:
{{{
sage: FM = CombinatorialFreeModule(QQ, ZZ)
sage: %timeit [FM.basis()[i] for i in range(100)]
5 loops, best of 3: 44.4 ms per loop
}}}
Adding a cache to {{{basis}}} gives a large speedup
{{{
sage: FM = CombinatorialFreeModule(QQ, ZZ)
sage: %timeit [FM.basis()[i] for i in range(100)]
125 loops, best of 3: 3.45 ms per loop
}}}
The speedup will be even larger with Simon King optimization on
cache_methods.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11402>
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.