Commit a492c97
committed
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.1 parent 6e43272 commit a492c97
1 file changed
+3
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
324 | 324 | | |
325 | 325 | | |
326 | 326 | | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
327 | 330 | | |
328 | 331 | | |
329 | 332 | | |
| |||
0 commit comments