-
-
Notifications
You must be signed in to change notification settings - Fork 685
Closed
Milestone
Description
UniqueRepresentation provides a comfortable way to create unique parent structures, and automatically provides a hash and certain comparison methods.
Problems:
- It relies on a metaclass, namely
ClasscallMetaclassand thus has to be a Python class. That's bad for speed. - It combines two features, namely a cache and unique instance behaviour. But in many some cases we want a cache so that two distinct instances can still be equal.
Here, I suggest to
- separate the two features, by creating a new class
sage.unique_representation.CachedRepresentationas one base ofUniqueRepresentation. - create a new cdef class
sage.misc.fast_methods.WithRichCmpById, that provides hash and rich comparison, as expected for unique instance behaviour.
Apply
Depends on #14017
Depends on #6495
Depends on #14182
Depends on #14040
Depends on #14011
CC: @nthiery
Component: performance
Keywords: cython UniqueRepresentation
Author: Simon King
Reviewer: Travis Scrimshaw
Merged: sage-5.8.beta4
Issue created by migration from https://trac.sagemath.org/ticket/14054