#13501: Fix two bugs in sage.misc.c3's implementation of the algorithm C3
-------------------------------------------------+--------------------------
Reporter: nthiery | Owner:
Type: defect | Status: needs_review
Priority: major | Milestone: sage-5.4
Component: categories | Resolution:
Keywords: method resolution order | Work issues:
Report Upstream: N/A | Reviewers: Simon King
Authors: Nicolas M. ThiƩry, Simon King | Merged in:
Dependencies: #12895 | Stopgaps:
-------------------------------------------------+--------------------------
Comment (by SimonKing):
This time, I used `%prun f(1000)` for the timings.
When I change the syntax, as suggested in the previous post, I get
{{{
ncalls tottime percall cumtime percall filename:lineno(function)
14000/1000 0.385 0.000 1.330 0.001 {sage.misc.c3.C3_algorithm}
}}}
With the current version of [attachment:trac_13501-c3-speedup-sk.patch], I
get
{{{
ncalls tottime percall cumtime percall filename:lineno(function)
14000/1000 0.380 0.000 1.297 0.001 {sage.misc.c3.C3_algorithm}
}}}
So, a further "complication" of the syntax is not good.
If I use a more readable syntax, hence replace `<sizt_t><void *>` by id
and avoid the temporary variable, I get roughly 10% slow-down:
{{{
ncalls tottime percall cumtime percall filename:lineno(function)
14000/1000 0.427 0.000 1.364 0.001 {sage.misc.c3.C3_algorithm}
}}}
Without the optimization patch (only your main patch), I get
{{{
ncalls tottime percall cumtime percall filename:lineno(function)
14000/1000 0.615 0.000 1.706 0.002 {sage.misc.c3.C3_algorithm}
}}}
Without your main patch (hence, the old buggy C3 version in Sage), I get
{{{
ncalls tottime percall cumtime percall filename:lineno(function)
14000/1000 0.442 0.000 1.558 0.002 {sage.misc.c3.C3_algorithm}
}}}
Hence, apparently the current version of my speedup patch is just fine.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13501#comment:26>
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.