Skip to content
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

[6.0][Macros] Optimize 'rangeContainsTokenLocWithGeneratedSource' #75144

Merged

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Jul 10, 2024

Cherry-pick #75130 into release/6.0

  • Explanation: Performance optimization. For some test case(Compiling many Swift Testing tests is significantly slower than XCTest tests swift-testing#502), we measured findBufferContainingLoc() was taking considerable amount of time in the entire compilation. This change reduces the number of calls of that function, and improves the hit-rate of the fast lastBufferID cache.
  • Scope: Type refinement context construction
  • Risk: Low. The change is small and targeted.
  • Testing: Passes current test suite. Locally confirmed the performance improvement
  • Issues: rdar://130478685
  • Reviewer: Doug Gregor (@DougGregor)

* Early return for the direct 'true' case.
* Instead of comparing the buffer IDs, check f the entire buffer
  contains the target range. This keeps 'LocCache.lastBufferID' and
  improves the hit rate.

(cherry picked from commit 126ad5c)
@rintaro rintaro requested a review from a team as a code owner July 10, 2024 21:18
@rintaro
Copy link
Member Author

rintaro commented Jul 10, 2024

@swift-ci Please test

@rintaro rintaro enabled auto-merge July 11, 2024 01:30
@rintaro rintaro merged commit 20b94d2 into swiftlang:release/6.0 Jul 11, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants