Skip to content

Remove unnecessary use of NoInlining and add traceability for valid uses, #931 #1134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 10, 2025

Conversation

paulirwin
Copy link
Contributor

  • You've read the Contributor Guide and Code of Conduct.
  • You've included unit or integration tests for your change, where applicable.
  • You've included inline docs for your change, where applicable.
  • There's an open issue for the PR that you are making. If you'd like to propose a change, please open an issue to discuss the change or find an existing issue.

Remove unnecessary use of NoInlining and add traceability for valid uses

Fixes #931

Description

This removes over 100 uses of NoInlining that did not trace back to actual usage in tests that inspect the stack trace, which unnecessarily harm performance. To determine this, debugging and code review was used to find which methods were actually being expected in the stack trace. Once the expected method was determined, the string literal of the method name was replaced with the nameof operator for go-to-definition traceability back to the method (or multiple overloads, in some cases) in question. Likewise, a comment was added on the use of NoInlining on the method to explain which test(s) needed this attribute. This way we have two-way traceability to help prevent accidental removal in the future. This could be improved with a custom dev analyzer and suppression in the near future.

One case remains, in PreFlexRWTermVectorsFormat, where I could not hit a breakpoint in tests that use this type, so I am not sure that it is actually needed. This was left as-is with a LUCENENET TODO comment. I presume it is likely expecting SegmentMerger.Merge like the similar PreFlexRWPostingsFormat, but I couldn't determine this for sure.

This PR is currently in draft status to ensure all tests pass. I'll publish it once I get extra validation that the removals are correct through multiple test runs.

@paulirwin
Copy link
Contributor Author

Build succeeded on ADO (after retrying an unrelated flaky test failure) as well as GitHub. Publishing PR for review.

@paulirwin paulirwin marked this pull request as ready for review March 7, 2025 17:43
@paulirwin paulirwin added the notes:performance-improvement Contains a performance improvement label Mar 7, 2025
@paulirwin paulirwin requested a review from NightOwl888 March 7, 2025 17:43
Copy link
Contributor

@NightOwl888 NightOwl888 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. Looks good except I think we should check whether we differ from Lucene in the PreFlexRWRTermVectorsFormat test. If Lucene also behaves this way, I think we should just leave it as is.

@NightOwl888 NightOwl888 self-requested a review March 10, 2025 15:16
@paulirwin paulirwin merged commit 54505e8 into apache:master Mar 10, 2025
276 checks passed
@paulirwin paulirwin deleted the issue/931-alt-1 branch March 10, 2025 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
notes:performance-improvement Contains a performance improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove unnecessary[MethodImpl(MethodImplOptions.NoInlining)]
2 participants