lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [lucenenet] theolivenbaum opened a new issue #375: Unnecessary boxing of IndexOptions enum
Date Mon, 19 Oct 2020 15:08:00 GMT

theolivenbaum opened a new issue #375:
URL: https://github.com/apache/lucenenet/issues/375


   Found another easy improvement:
   
   There are plenty of calls to IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS)
in the code, such as [this one](https://github.com/apache/lucenenet/blob/fc2da940da3ca32c2fe6ae9caf69f36b69f3de7f/src/Lucene.Net/Codecs/BlockTreeTermsReader.cs#L1158):
   
   `````csharp
   if (outerInstance.fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS)
< 0)
   {
       // Positions were not indexed:
       return null;
   }
   `````
   
   The problem is that CompareTo receives an object, which leads to boxing the enum:
   
   ![image](https://user-images.githubusercontent.com/8791811/96469497-922a3500-122d-11eb-92e1-40e3fd13eb22.png)
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message