NightOwl888 opened a new issue #353: URL: https://github.com/apache/lucenenet/issues/353
IndexSearcher has 2 nested classes that are each being instantiated in a tight loop: 1. [`SearcherCallableNoSort`](https://github.com/apache/lucenenet/blob/ece6bea0a3c98961a77d7060b5615fccefabe725/src/Lucene.Net/Search/IndexSearcher.cs#L721-L768) 2. [`SearcherCallableWithSort`](https://github.com/apache/lucenenet/blob/ece6bea0a3c98961a77d7060b5615fccefabe725/src/Lucene.Net/Search/IndexSearcher.cs#L770-L832) Each of these classes implements `ICallable<T>`, an interface that was carried over from Java. The closest match in .NET is `Func<T>`. Both classes (and their many member variables) can be eliminated and their `Call()` method placed in the inline body of `Func<T>`, which will eliminate the class instantiation per loop. I suspect this will have a performance impact, but even if not this is a step away from Java and toward .NET. `TaskSchedulerCompletionService.Submit(ICallable<T> task)` should be modified to accept a `Func<T>` and doesn't need to implement `ICompletionService<T>`. We should also aim to factor out (and delete) `ICallable<T>` and `ICompletionService<T>` from Lucene.NET. ---------------------------------------------------------------- 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: [email protected]
