#12969: Coercion failures in symmetric functions
-------------------------------------------------+--------------------------
Reporter: aschilling | Owner: sage-combinat
Type: defect | Status: new
Priority: major | Milestone: sage-5.3
Component: combinatorics | Resolution:
Keywords: symmetric functions, coercion | Work issues:
Report Upstream: N/A | Reviewers:
Authors: | Merged in:
Dependencies: | Stopgaps:
-------------------------------------------------+--------------------------
Comment (by SimonKing):
Replying to [comment:19 SimonKing]:
> And while we are at it: _register_pair uses a dictionary in order to
implement a set. I think it would be more efficient to use a set right
away.
No, to my surprise, it isn't:
{{{
sage: cython("""
....: def testD(dict D):
....: cdef int i
....: for i from 0<=i<10000:
....: b = (i in D)
....: def testS(set S):
....: cdef int i
....: for i from 0<=i<10000:
....: b = (i in S)
....: """)
sage: D = dict([(i,1) for i in range(5000)])
sage: S = set(range(5000))
sage: %timeit testD(D)
625 loops, best of 3: 495 µs per loop
sage: %timeit testS(S)
625 loops, best of 3: 520 µs per loop
sage: %timeit testD(D)
625 loops, best of 3: 496 µs per loop
sage: %timeit testS(S)
625 loops, best of 3: 520 µs per loop
}}}
Sets seem slower than dictionaries by 5%.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12969#comment:20>
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.