Skip to content

Make caching the typeref builder cache lazier #40432

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 1 commit into from
Dec 7, 2021

Conversation

augusto2112
Copy link
Contributor

Currently, when we have a cache miss on the typeref cache, we parse all the metadata that we know of, before querying the cache again. Change this to query for the typeref after parsing every reflection info. This will be especially useful for LLDB, as it uses a client server model, and parsing metadata may involve going through a (potentially slow network).

This PR also has an added benefit of not re-parsing metadata that was already parsed before, if, for example, a new image is loaded in between different typeref queries.

@augusto2112
Copy link
Contributor Author

@swift-ci smoke test

Copy link
Contributor

@adrian-prantl adrian-prantl left a comment

Choose a reason for hiding this comment

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

This looks like a nice performance win when debugging apps with dynamic libraries.


// Index of the next Reflection Info that should be processed.
// This assumes that Reflection Infos are never removed from the vector.
size_t CurrentReflectionInfoIndex = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Does FirstUnprocessedReflectionInfoIndex convey the intention better?

@@ -643,6 +643,10 @@ class TypeRefBuilder {

private:
std::vector<ReflectionInfo> ReflectionInfos;

// Index of the next Reflection Info that should be processed.
// This assumes that Reflection Infos are never removed from the vector.
Copy link
Contributor

Choose a reason for hiding this comment

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

///

@augusto2112
Copy link
Contributor Author

@swift-ci smoke test

@augusto2112 augusto2112 merged commit 981c358 into swiftlang:main Dec 7, 2021
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.

3 participants