[Python-Dev] Caching float(0.0)
Kristján V. Jónsson
kristjan at ccpgames.com
Tue Oct 3 12:15:26 CEST 2006
But that is precisely the point. A non-floating point application tends to use floating point values in a predictable way, with a lot of integral values floating around and lots of zeroes. As this constitutes the majority of python applications (okay, daring assumption here) it seems to warrant some consideration.
In one of my first messages on the subject I promised to report refcounts of -1.0, 0.0 and 1.0 for the EVE server as being. I didn't but instead gave you the frequency of the values reported. Well , now I can provide you with refcounts for the [-10, 10] range plus the total float count, of a server that has just started up:
The total count of floating point numbers allocated at this point is 985794.
Without the reuse, they would be 1317145, so this is a saving of 25%, and of 5Mb.
> -----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 skip at pobox.com
> Sent: 3. október 2006 00:54
> To: Terry Reedy
> Cc: python-dev at python.org
> Subject: Re: [Python-Dev] Caching float(0.0)
> Terry> "Kristján V. Jónsson" <kristjan at ccpgames.com> wrote:
> >> Anyway, Skip noted that 50% of all floats are whole
> numbers between
> >> -10 and 10 inclusive,
> Terry> Please, no. He said something like this about
> Terry> *non-floating-point applications* (evidence
> unspecified, that I
> Terry> remember). But such applications, by definition,
> usually don't
> Terry> have enough floats for caching (or conversion
> time) to matter too
> Terry> much.
> Correct. The non-floating-point application I chose was the
> one that was most immediately available, "make test". Note
> that I have no proof that regrtest.py isn't terribly floating
> point intensive. I just sort of guessed that it was.
More information about the Python-Dev