#14100: Make raising attribute errors faster
----------------------------------+-----------------------------------------
Reporter: SimonKing | Owner: tbd
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-5.8
Component: performance | Resolution:
Keywords: AttributeError | Work issues:
Report Upstream: N/A | Reviewers:
Authors: Simon King | Merged in:
Dependencies: | Stopgaps:
----------------------------------+-----------------------------------------
Changes (by {'newvalue': u'Simon King', 'oldvalue': u'SimonKing'}):
* status: new => needs_review
* author: SimonKing => Simon King
Comment:
Here are some timings, similar to what we did on #11342.
sage-5.7.beta2 with patch:
{{{
sage: a = 1
sage: timeit('try: QQ.__bla\nexcept: pass')
625 loops, best of 3: 3.85 µs per loop
sage: timeit('try: a.__bla\nexcept: pass')
625 loops, best of 3: 2.47 µs per loop
sage: timeit('try: QQ.__bla_\nexcept: pass')
625 loops, best of 3: 5.71 µs per loop
sage: timeit('try: QQ.__bla_\nexcept: pass')
625 loops, best of 3: 5.78 µs per loop
sage: timeit('try: a.__bla_\nexcept: pass')
625 loops, best of 3: 5.35 µs per loop
sage: timeit('try: QQ.bla\nexcept: pass')
625 loops, best of 3: 5.78 µs per loop
sage: timeit('try: a.bla\nexcept: pass')
625 loops, best of 3: 4.92 µs per loop
sage: timeit('try: QQ.sum\nexcept: pass',number=10^5)
100000 loops, best of 3: 1.13 µs per loop
sage: timeit('try: a.cartesian_product\nexcept: pass',number=10^5)
100000 loops, best of 3: 2.1 µs per loop
}}}
Without the patch:
{{{
sage: a = 1
sage: timeit('try: QQ.__bla\nexcept: pass')
625 loops, best of 3: 4.31 µs per loop
sage: timeit('try: a.__bla\nexcept: pass')
625 loops, best of 3: 3 µs per loop
sage: timeit('try: QQ.__bla_\nexcept: pass')
625 loops, best of 3: 6.11 µs per loop
sage: timeit('try: a.__bla_\nexcept: pass')
625 loops, best of 3: 5.49 µs per loop
sage: timeit('try: QQ.bla\nexcept: pass')
625 loops, best of 3: 6.06 µs per loop
sage: timeit('try: a.bla\nexcept: pass')
625 loops, best of 3: 5.4 µs per loop
sage: timeit('try: QQ.sum\nexcept: pass',number=10^5)
100000 loops, best of 3: 1.12 µs per loop
sage: timeit('try: a.cartesian_product\nexcept: pass',number=10^5)
100000 loops, best of 3: 2.35 µs per loop
}}}
I think speed-up is significant.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14100#comment:1>
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.