Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make infinity rings a subclass of singleton #20831

Closed
tscrim opened this issue Jun 15, 2016 · 6 comments
Closed

Make infinity rings a subclass of singleton #20831

tscrim opened this issue Jun 15, 2016 · 6 comments

Comments

@tscrim
Copy link
Collaborator

tscrim commented Jun 15, 2016

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.

CC: @rwst @paulmasson @eviatarbach

Component: symbolics

Author: Travis Scrimshaw

Branch/Commit: 099d7ce

Reviewer: Ralf Stephan

Issue created by migration from https://trac.sagemath.org/ticket/20831

@tscrim tscrim added this to the sage-7.3 milestone Jun 15, 2016
@tscrim tscrim self-assigned this Jun 15, 2016
@tscrim
Copy link
Collaborator Author

tscrim commented Jun 15, 2016

@tscrim
Copy link
Collaborator Author

tscrim commented Jun 15, 2016

Commit: 099d7ce

@tscrim
Copy link
Collaborator Author

tscrim commented Jun 15, 2016

New commits:

099d7ceMake the infinity rings subclasses of Singleton.

@rwst
Copy link

rwst commented Jun 15, 2016

comment:2

Passes tests with patchbot and LGTM.

@rwst
Copy link

rwst commented Jun 15, 2016

Reviewer: Ralf Stephan

@vbraun
Copy link
Member

vbraun commented Jun 16, 2016

Changed branch from public/rings/make_infinity_ring_singleton-20831 to 099d7ce

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants