Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-467

Use Float.floatToRawIntBits over Float.floatToIntBits

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9
    • Fix Version/s: None
    • Component/s: core/other
    • Labels:
      None

      Description

      Copied From my Email:
      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.

        Attachments

          Activity

            People

            • Assignee:
              yseeley@gmail.com Yonik Seeley
              Reporter:
              yseeley@gmail.com Yonik Seeley
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: