Details
-
Task
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
Lucene.Net 4.8.0
-
None
Description
As per LUCENENET-640, the TokenStream.AssertFinal method is causing performance issues. This method was used to assert that the usage of TokenStream is correct - that is, subclasses or their IncrementToken() method must be sealed.
In Java, there is not a performance issue because asserts are presumably turned off in production applications and the Reflection overhead only happens when debugging. However, in .NET asserts are compiled out of the final release so doing it in a similar way would disable the feature for end users.
Instead, we should create Rosnlyn code analyzers to ensure the project doesn't compile unless the end user seals either the class or its IncrementToken() method. This effectively means we leave the heavy code analysis up to the IDE/build and it doesn't run at all in production.
Per this article, it is feasible to package a code analyzer into the Lucene.Net NuGet package so when it is installed the code analysis will take effect in the IDE.
Attachments
Issue Links
- Is contained by
-
LUCENENET-630 Identify/Fix Bottlenecks
- Closed
- is related to
-
LUCENENET-640 Sequential IndexWriter performance in concurrent environments.
- Closed