theolivenbaum opened a new issue #350:
URL: https://github.com/apache/lucenenet/issues/350
Doing a random check with a memory profiler on the search benchmark test, and it seems
like a lot of the objects being allocated are ScoreDoc instances:

Is there any good reason to not refactor this as a struct?
The code is so simple that it feels like an easy win to change it to a struct:
```csharp
public class ScoreDoc
{
public float Score { get; set; } // LUCENENET NOTE: For some reason, this was not
readonly - should it be?
public int Doc { get; set; } // LUCENENET NOTE: For some reason, this was not readonly
- should it be?
public int ShardIndex { get; set; } // LUCENENET NOTE: For some reason, this was
not readonly - should it be?
public ScoreDoc(int doc, float score) : this(doc, score, -1) { }
public ScoreDoc(int doc, float score, int shardIndex)
{
this.Doc = doc;
this.Score = score;
this.ShardIndex = shardIndex;
}
}
```
----------------------------------------------------------------
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
|