lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <cutt...@apache.org>
Subject Re: Float.floatToRawIntBits
Date Wed, 16 Nov 2005 22:24:41 GMT
In general I would not take this sort of profiler output too literally. 
  If floatToRawIntBits is 5x faster, then you'd expect a 16% improvement 
from using it, but my guess is you'll see far less.  Still, it's 
probably worth switching & measuring as it might be significant.

Doug

Paul Smith wrote:
> I can confirm this takes ~ 20% of an overall Indexing operation (see  
> attached link from YourKit).
> 
> http://people.apache.org/~psmith/luceneYourkit.jpg
> 
> Mind you, the whole "signalling via IOException" in the  FastCharStream 
> is a way bigger overhead, although I agree much harder  to fix.
> 
> Paul Smith
> 
> On 17/11/2005, at 7:21 AM, Yonik Seeley wrote:
> 
>> Float.floatToRawIntBits (in Java1.4) gives the raw float bits without
>> normalization (like *(int*)&floatvar would in C).  Since it doesn't do
>> normalization of NaN values, it's faster (and hopefully optimized to a
>> simple inline machine instruction by the JVM).
>>
>> On my Pentium4, using floatToRawIntBits is over 5 times as fast as
>> floatToIntBits.
>> That can really add up in something like Similarity.floatToByte() for
>> encoding norms, especially if used as a way to compress an array of
>> float during query time as suggested by Doug.
>>
>> -Yonik
>> Now hiring -- http://forms.cnet.com/slink?231706
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-dev-help@lucene.apache.org
>>
>>
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Mime
View raw message