[Python-Dev] Caching float(0.0)

Kristján V. Jónsson kristjan at ccpgames.com
Fri Sep 29 17:18:17 CEST 2006


Acting on this excellent advice, I have patched in a reuse for -1.0, 0.0 and 1.0 for EVE Online.  We use vectors and stuff a lot, and 0.0 is very, very common.  I'll report on the refcount of this for you shortly.

K 

> -----Original Message-----
> From: python-dev-bounces+kristjan=ccpgames.com at python.org 
> [mailto:python-dev-bounces+kristjan=ccpgames.com at python.org] 
> On Behalf Of Fredrik Lundh
> Sent: 29. september 2006 15:11
> To: python-dev at python.org
> Subject: Re: [Python-Dev] Caching float(0.0)
> 
> Nick Craig-Wood wrote:
> 
> > Is there any reason why float() shouldn't cache the value 
> of 0.0 since 
> > it is by far and away the most common value?
> 
> says who ?
> 
> (I just checked the program I'm working on, and my analysis 
> tells me that the most common floating point value in that 
> program is 121.216, which occurs 32 times.  from what I can 
> tell, 0.0 isn't used at all.)
> 
> </F>
> 
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: 
> http://mail.python.org/mailman/options/python-dev/kristjan%40c
cpgames.com
> 


More information about the Python-Dev mailing list