[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:
-10,0 589
-9,0 56
-8,0 65
-7,0 63
-6,0 243
-5,0 731
-4,0 550
-3,0 246
-2,0 246
-1,0 1096
0,0 195446
1,0 79382
2,0 9650
3,0 6224
4,0 5223
5,0 14766
6,0 2616
7,0 1303
8,0 3307
9,0 1447
10,0 8102
total: 331351
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.
Kristján
> -----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.
>
> Skip
More information about the Python-Dev
mailing list