[issue14381] Intern certain integral floats for memory savings and performance

Antoine Pitrou report at bugs.python.org
Thu Mar 22 15:59:46 CET 2012


Antoine Pitrou <pitrou at free.fr> added the comment:

> Integers don't fall out of arithmetic that often, true.  But integral
> floats are incredibly common in tabular data.  In a game such as Eve
> Online,  configuration data contains a lot of 0.0, 1.0, -1.0 and so
> on.  This patch saved us many megabytes on the server.

Can't you do your own interning when reading configuration data? You can even do it in pure Python.

If CPython starts interning some integral floats, I think only {-1.0, -0.0, 0.0, 1.0} should apply. The rest is too application-specific.

----------
nosy: +pitrou

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14381>
_______________________________________


More information about the Python-bugs-list mailing list