#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 | Merged in:
Dependencies: #12895 | Stopgaps:
-------------------------------------------+--------------------------------
Changes (by SimonKing):
* owner: nthiery =>
Comment:
Here is evidence that using a set of memory locations is way faster than a
set of objects, if what we actually want is comparison by identity.
Namely:
{{{
sage: cython("""
....: def test1(set S, object O):
....: return O in S
....: def test2(set S, object O):
....: return <size_t><void *>O in S
....: """)
sage: S = set(Algebras(GF(p)) for p in prime_range(10000))
sage: Sid = set(id(O) for O in S)
sage: len(S)
1229
sage: len(Sid)
1229
sage: O = Algebras(GF(151))
sage: test1(S,O)
True
sage: test2(Sid,O)
True
sage: %timeit test1(S,O)
625 loops, best of 3: 507 ns per loop
sage: %timeit test2(Sid,O)
625 loops, best of 3: 186 ns per loop
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13501#comment:19>
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.