Message74224
Here is a patch to make PyFloat_FromDouble(0.0) always return the same
float instance. This is similar to the existing optimization in
PyInt_FromLong(x) for small x.
My own motivation is that the patch reduces memory by several megabytes
for a particular in-house data processing script, but I think that it
should be generally useful assuming that zero is a very common float
value, and at worst almost neutral when this assumption is wrong. The
minimal performance impact of the test for zero should be easily
recovered by reduced memory allocation calls. I am happy to look into
benchmarking if you require empirical performance data. |
|
Date |
User |
Action |
Args |
2008-10-03 03:25:07 | ldeller | set | recipients:
+ ldeller |
2008-10-03 03:25:06 | ldeller | set | messageid: <1223004306.88.0.574076862856.issue4024@psf.upfronthosting.co.za> |
2008-10-03 03:25:05 | ldeller | link | issue4024 messages |
2008-10-03 03:25:05 | ldeller | create | |
|