Mark Dickinson <dicki...@gmail.com> added the comment: A random data point: just for fun, I just tried assessing the impact of __slots__ on Decimal instances, by the crude method of putting all of the Decimal instances that are created during a complete run of the Decimal test suite (over 100000 of them) into a list and watching memory usage. This was on a non-debug 32-bit build of py3k, with 16-bit Py_UNICODE (which is relevant because the coefficients of Decimal instances are strings).
Results: (*) ~44 bytes per Decimal on average with __slots__ ~183 bytes per Decimal on average without __slots__ The effect on speed wasn't really significant: removing __slots__ gives at worst a 1-2% slowdown on a complete run of the test-suite. So please let's not remove __slots__ from Fraction! (*) raw numbers: 120343 total number of Decimals. The following are memory readings from the RSIZE column of top. with __slots__: putting 8 copies of each Decimal into list -> 33M total usage putting 4 copies of each Decimal into list -> 55M total usage without __slots__: putting 8 copies of each Decimal into list -> 182M total usage putting 4 copies of each Decimal into list -> 96M total usage. I took the liberty of subtracting 4 bytes per list entry, to compensate for the memory taken by the list itself. _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue4998> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com