#12615: sign(integer) is horribly slow
------------------------------------+---------------------------------------
Reporter: zimmerma | Owner: AlexGhitza
Type: enhancement | Status: needs_info
Priority: major | Milestone: sage-5.6
Component: basic arithmetic | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: | Merged in:
Dependencies: | Stopgaps:
------------------------------------+---------------------------------------
Changes (by zimmerma):
* status: needs_review => needs_info
Comment:
Robert, thanks, I see a speedup of a factor of more than 10 on my example:
{{{
sage: a=-17
sage: %timeit s = sign(a)
625 loops, best of 3: 41 µs per loop
sage: %timeit s = a//abs(a)
625 loops, best of 3: 257 ns per loop
}}}
However I wonder about the need of the "pool" cache for integers in
[-5,100], since the speedup is "only" about 20%:
{{{
sage: a=100
sage: %timeit s = sign(a)
625 loops, best of 3: 34.7 µs per loop
sage: a=101
sage: %timeit s = sign(a)
625 loops, best of 3: 41.5 µs per loop
}}}
Paul
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12615#comment:9>
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.