#15038: Improve startuptime by postponing the creation of argspecs of cached
functions/methods
-------------------------------------------------+-------------------------
Reporter: SimonKing | Owner:
Type: enhancement | Status:
Priority: major | needs_review
Component: performance | Milestone:
Keywords: cached method, argspec, | sage-5.12
introspection, startup | Resolution:
Authors: Simon King | Merged in:
Report Upstream: N/A | Reviewers:
Branch: | Work issues:
Stopgaps: | Dependencies:
-------------------------------------------------+-------------------------
Comment (by SimonKing):
Startup time is not everything, I think we should also test that there is
no big regression in *calling* a cached method.
With the patch:
{{{
sage: @cached_function
....: def f(a,b=1):
....: return 1
....:
sage: class C:
....: @cached_method
....: def a(self):
....: return 1
....: @cached_method
....: def b(self, a,b=1,*args,**kwds):
....: return 2
....:
sage: c = C()
sage: %timeit f(1)
1000000 loops, best of 3: 916 ns per loop
sage: %timeit f(1,2)
1000000 loops, best of 3: 984 ns per loop
sage: %timeit f(a=1,b=2)
100000 loops, best of 3: 2.56 us per loop
sage: %timeit c.b(1,x=4)
100000 loops, best of 3: 2.8 us per loop
sage: %timeit c.b(1,4)
1000000 loops, best of 3: 886 ns per loop
}}}
Without the patch:
{{{
sage: c = C()
sage: %timeit f(1)
1000000 loops, best of 3: 922 ns per loop
sage: %timeit f(1,2)
1000000 loops, best of 3: 975 ns per loop
sage: %timeit f(a=1,b=2)
100000 loops, best of 3: 2.42 us per loop
sage: %timeit c.b(1,x=4)
100000 loops, best of 3: 2.86 us per loop
sage: %timeit c.b(1,4)
1000000 loops, best of 3: 991 ns per loop
}}}
I think this is fine. So, if the startup time would really improve by a
couple percent, it would be a good progress.
--
Ticket URL: <http://trac.sagemath.org/ticket/15038#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 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/groups/opt_out.