# HG changeset patch # User John Rouillard # Date 1762191768 18000 # Node ID a73ac3752ac5ed62c07a4abc921b93e71fba2742 # Parent 224ccb8b49ca54569350edb5905b19185a97b092 refactor: mke Date class use __slots__ This should be the last slotting for a while. Instrumenting roundup-admin and the Client class (running under the waitress wsgi server) shows object count output similar to: [(('IssueClass', 'roundup.backends.back_anydbm'), 128), (('Session', 'roundup.cgi.client'), 128), (('Mailer', 'roundup.mailer'), 128), (('Password', 'roundup.password'), 220), (('LiberalCookie', 'roundup.cgi.client'), 241), (('Database', 'roundup.backends.back_anydbm'), 256), (('FileClass', 'roundup.backends.back_anydbm'), 256), (('Number', 'roundup.hyperdb'), 256), (('PythonExpr', 'roundup.cgi.PageTemplates.PythonExpr'), 274), (('Proptree', 'roundup.hyperdb'), 276), (('Role', 'roundup.security'), 384), (('PathExpr', 'roundup.cgi.PageTemplates.Expressions'), 630), (('Class', 'roundup.backends.back_anydbm'), 640), (('SubPathExpr', 'roundup.cgi.PageTemplates.Expressions'), 645), (('Date', 'roundup.hyperdb'), 678), (('Link', 'roundup.hyperdb'), 934), (('Multilink', 'roundup.hyperdb'), 1024), (('Permission', 'roundup.security'), 6784), (('TruthDict', 'roundup.support'), 6795), (('PrioList', 'roundup.support'), 8192), (('Date', 'roundup.date'), 8610)] where each row is a tuple of (class, module) and the count of the number of object of that class sorted by number of objects. I think the major classes that meet the criteria below are all __slotted__ at this point: Is a native roundup class and not a subclass (e.g. LiberalCookie is subclass of http.cookies.SimpleCookie) Does not touch the database (not hyperdb or backend) Is not part of templating Is not a top level class that may need runtime attributes/methods overwritten e.g Session/Mailer/Password Some of the excluded classes can be slotted, but they are not low hanging fruit and requires more class heirarchy changes or more extensive testing. diff -r 224ccb8b49ca -r a73ac3752ac5 roundup/date.py --- a/roundup/date.py Mon Nov 03 00:13:04 2025 -0500 +++ b/roundup/date.py Mon Nov 03 12:42:48 2025 -0500 @@ -324,6 +324,9 @@ >>> test_fin(u) ''' + __slots__ = ("year", "month", "day", "hour", "minute", "second", + "_", "ngettext", "translator") + def __init__(self, spec='.', offset=0, add_granularity=False, translator=i18n): """Construct a date given a specification and a time zone offset.