You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Don't call _repr_() on the parents every time a coercion or conversion fails. (One could consider making Parent.__repr__() keep the name in cache instead, but we probably don't want that for things like finite fields, and in any case __repr__() is handled by SageObject at the moment.)
Add a fast path for trivial coercions in Parent.coerce(foo).
Before:
sage: R.<x,y,z> = ZZ[]
sage: a = GF(3)(2)
sage: %timeit x(a,a,a)
The slowest run took 37.44 times longer than the fastest. This could mean that an intermediate result is being cached.
100000 loops, best of 3: 13.1 µs per loop
After:
sage: R.<x,y,z> = ZZ[]
sage: a = GF(3)(2)
sage: %timeit x(a,a,a)
The slowest run took 162.14 times longer than the fastest. This could mean that an intermediate result is being cached.
100000 loops, best of 3: 3.98 µs per loop
I do not think we want to cache the result of Parent.__repr__ because that is designed so you can dynamically change the repr of the object via foo.rename('bar').
I do not think we want to cache the result of Parent.__repr__ because that is designed so you can dynamically change the repr of the object via foo.rename('bar').
Yes, that's an additional reason, though one could imagine making rename() update the cache.
_repr_()
on the parents every time a coercion or conversion fails. (One could consider makingParent.__repr__()
keep the name in cache instead, but we probably don't want that for things like finite fields, and in any case__repr__()
is handled bySageObject
at the moment.)Parent.coerce(foo)
.Before:
After:
Component: performance
Author: Marc Mezzarobba
Branch/Commit:
3b49d0a
Reviewer: Travis Scrimshaw
Issue created by migration from https://trac.sagemath.org/ticket/27379
The text was updated successfully, but these errors were encountered: