#20831: Make infinity rings a subclass of singleton
---------------------------+------------------------------------
Reporter: tscrim | Owner: tscrim
Type: enhancement | Status: new
Priority: major | Milestone: sage-7.3
Component: symbolics | Keywords:
Merged in: | Authors: Travis Scrimshaw
Reviewers: | Report Upstream: N/A
Work issues: | Branch:
Commit: | Dependencies:
Stopgaps: |
---------------------------+------------------------------------
Subclasses of `Singleton` are over 3x faster when recreating the ring:
{{{
sage: from sage.misc.fast_methods import Singleton
sage: from sage.rings.infinity import _uniq
sage: class Foo(_uniq, object):
....: def __init__(self):
....: pass
sage: class Bar(Singleton, object):
....: def __init__(self):
....: pass
sage: %timeit Foo()
The slowest run took 71.72 times longer than the fastest. This could mean
that an intermediate result is being cached.
1000000 loops, best of 3: 306 ns per loop
sage: %timeit Bar()
The slowest run took 400.59 times longer than the fastest. This could mean
that an intermediate result is being cached.
10000000 loops, best of 3: 94.6 ns per loop
}}}
Also IMO, it is a more Sage standard class than the `_uniq`, and so, more
maintainable.
--
Ticket URL: <http://trac.sagemath.org/ticket/20831>
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 https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.