paulirwin commented on issue #1050:
URL: https://github.com/apache/lucenenet/issues/1050#issuecomment-2501791569

   I can reproduce with enough repeats on net8.0 macOS arm64. I'm fairly 
certain that what we're seeing is .NET 8's Dynamic PGO inlining this trivial 
method at runtime. Much more further reading, but search the page for "inline" 
to see that it does inline trivial methods if it determines that is beneficial: 
https://devblogs.microsoft.com/dotnet/performance-improvements-in-net-8/
   
   We could force prevent this with 
`[MethodImpl(MethodImplOptions.NoInlining)]` on CheckMaxClauseCount (and 
initial results in my testing shows that seems to fix it), but IMO we should 
not rely on that. I think we should remove this assertion, even though it 
exists upstream (where Java did not have anything like .NET 8's Dynamic PGO to 
affect this stack trace), with a LUCENENET-specific comment explaining why 
we're removing it:
   
   ```c#
   //  Maybe remove this assert in later versions, when internal API changes:
   Assert.AreEqual("CheckMaxClauseCount", new StackTrace(e, 
false).GetFrames()[0].GetMethod().Name); //, "Should throw 
BooleanQuery.TooManyClauses with a stacktrace containing 
checkMaxClauseCount()");
   ```
   
   We should only care that a `BooleanQuery.TooManyClausesException` is thrown 
here, and not which specific method throws it.


-- 
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.

To unsubscribe, e-mail: dev-unsubscr...@lucenenet.apache.org

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

Reply via email to