This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ldeller
Recipients ldeller
Date 2008-10-03.03:25:04
SpamBayes Score 8.943549e-08
Marked as misclassified No
Message-id <1223004306.88.0.574076862856.issue4024@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2008-10-03 03:25:07ldellersetrecipients: + ldeller
2008-10-03 03:25:06ldellersetmessageid: <1223004306.88.0.574076862856.issue4024@psf.upfronthosting.co.za>
2008-10-03 03:25:05ldellerlinkissue4024 messages
2008-10-03 03:25:05ldellercreate