[squeak-dev] Re: Speeding up Float Numbers reading

Andreas Raab andreas.raab at gmx.de
Tue Mar 11 05:44:03 UTC 2008


nicolas cellier wrote:
> A difference is that SqNumberParser does return the nearest floating 
> point value, while ReadStream>>nextFloat does return an approximate. 
> This explains some of the bad scores of the former which cannot avoid 
> LargeInteger arithmetic when the latter does (cases of exponent with 
> high values).

Interesting. Do you have an example for this? I went to great length to 
ensure that #nextFloat answers consistent results to Float>>readFrom: 
(otherwise I could have optimized various cases even more aggressively) 
so I'd be interested in seeing cases where it differs.

Test cases would probably be best but in absence of those some general 
guidance about how to create the problem would be appreciated.

> Last thing, speeding up Float reading is not premature optimization, 
> large files made of formatted Float are widely used in some areas.
> Sure an atof() primitive would probably outperform if that really 
> matters...

Absolutely. I was considering just that except that I wasn't quite sure 
whether the various C runtime libs would implement atof in a 
bit-identical manner (as a matter of fact I'm pretty sure they don't). 
Since this was a requirement for Croquet I opted for optimizing the read 
with the means I had available.

Cheers,
   - Andreas




More information about the Squeak-dev mailing list