#13589: Controlling C3 to solve once for all the Method Resolution Order issues
for
category classes
----------------------------------------------------------+-----------------
Reporter: nthiery | Owner:
nthiery
Type: defect | Status:
needs_review
Priority: major | Milestone:
sage-5.11
Component: categories | Resolution:
Keywords: method resolution order, C3 | Work issues:
Report Upstream: N/A | Reviewers:
Simon King, Florent Hivert
Authors: Nicolas M. Thiéry | Merged in:
Dependencies: #12894, #12876, #11935, #12895, #10193 | Stopgaps:
----------------------------------------------------------+-----------------
Comment (by SimonKing):
I have cythoned the _cmp_key attribute of `CategoryWithParameters` as
well. The raw improvement is:
Without the first two patches:
{{{
sage: C = Algebras(FractionField(QQ['x']))
sage: timeit("if C._cmp_key: del C._cmp_key", number=100000)
100000 loops, best of 3: 5.38 µs per loop
}}}
With all patches:
{{{
sage: C = Algebras(FractionField(QQ['x']))
sage: timeit("if C._cmp_key: del C._cmp_key", number=100000)
100000 loops, best of 3: 1.28 µs per loop
}}}
But I think the startup time is what we are really interested in. My
starting point is sage-5.11.b3 with these patches applied:
{{{
trac_14471_dynamic_class_hash.patch
trac_14471-review.patch
trac_14516-crystals_speedup-ts.2.patch
trac_14722-lazy_import_at_startup-nt.patch
}}}
I am giving the total time provided by sage -startuptime, in 5 consecutive
runs:
{{{
Total time (sum over exclusive time): 1485.052ms
Total time (sum over exclusive time): 1499.287ms
Total time (sum over exclusive time): 1499.921ms
Total time (sum over exclusive time): 1492.086ms
Total time (sum over exclusive time): 1493.375ms
}}}
After applying the first two patches, I get:
{{{
Total time (sum over exclusive time): 1495.342ms
Total time (sum over exclusive time): 1504.880ms
Total time (sum over exclusive time): 1502.199ms
Total time (sum over exclusive time): 1497.281ms
Total time (sum over exclusive time): 1508.277ms
}}}
And after applying the other two patches, I get:
{{{
Total time (sum over exclusive time): 1499.909ms
Total time (sum over exclusive time): 1498.731ms
Total time (sum over exclusive time): 1499.289ms
Total time (sum over exclusive time): 1502.179ms
Total time (sum over exclusive time): 1489.887ms
}}}
I think one sees a tendency. But we'd really need to see what the startup-
time plugin has to say!
Apply trac_13589-categories-c3_under_control-nt.patch
trac13589_cmp_key_attribute.patch trac13589_improve_startuptime.patch
trac13589_cython_cmp_key.patch
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13589#comment:60>
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.