lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joe Shaw (JIRA)" <j...@apache.org>
Subject [jira] Created: (LUCENENET-30) Unnecessary boxing of bytes
Date Wed, 29 Nov 2006 19:36:21 GMT
Unnecessary boxing of bytes
---------------------------

                 Key: LUCENENET-30
                 URL: http://issues.apache.org/jira/browse/LUCENENET-30
             Project: Lucene.Net
          Issue Type: Improvement
         Environment: Linux, Lucene.Net 2.0
            Reporter: Joe Shaw


SegmentReader.CreateFakeNorms() unnecessarily boxes bytes:

byte[] ones = new byte[size];
byte val = DefaultSimilarity.EncodeNorm(1.0f);
for (int index = 0; index < size; index++)
    ones.SetValue(val, index);

Because Array.SetValue() takes an object for the first argument, each byte is boxed.

Changing the SetValue() call to:

    ones [index] = val;

fixes the problem, because array indexers are type checked.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message