Skip to content

Conversation

augusto2112
Copy link
Contributor

@augusto2112 augusto2112 commented Jul 5, 2022

Description: Currently, whenever we're asked to retrieve a particular FieldDescriptor for a TypeRef, we naively parse all the ReflectionInfos in the order they were registered (caching everything) until we find the one we're looking for. This can be very costly for the debugger, as we may be reading memory from a remote target. This patch introduces a heuristic to prioritize this search by processing first ReflectionInfos where the FieldDescriptor we're looking for is likely to be. If the heuristic fails, we fallback to the old behavior. In profiling debugging large apps, this has significant impact on the time to stop on the first breakpoint.
Risk: Low. If the heuristic fails we fall back to the old behavior.
Testing: Swift reflection tests plus all lldb tests that use frame variable.
Original PR: #59802 plus Typeref.cpp changes from #59262
Issue: rdar://87889973

Currently when looking for field descriptors we parse the reflection
metadata in whatever order it was registered. This patch implements a
heuristic where we try to match a new optional Name field with the
module name of the type's field descriptor we're looking for.

rdar://87889973
(cherry picked from commit 65a9e7d)
@augusto2112
Copy link
Contributor Author

@swift-ci test

@augusto2112 augusto2112 marked this pull request as ready for review July 6, 2022 20:40
@augusto2112 augusto2112 requested a review from a team as a code owner July 6, 2022 20:40
@augusto2112 augusto2112 merged commit f5eff1a into swiftlang:release/5.7 Jul 6, 2022
@augusto2112
Copy link
Contributor Author

Thanks @nkcsgexi!

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