-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
[AST] Cache the override generic signatures #26190
[AST] Cache the override generic signatures #26190
Conversation
cc @slavapestov This is a very simple implementation, but let me know your thoughts! |
@slavapestov I have addressed your comments. Does it look good to you now? Thanks! |
Thanks @slavapestov, could you take another look? |
@swift-ci Please smoke test |
@swift-ci Please test compiler performance |
Hmm it seems like the caching didn’t make a huge difference: https://ci.swift.org/job/swift-PR-compiler-performance-macOS/439/artifact/comment.md/*view*/ -0.29% GSBs in debug, -0.46% in release. I’m not sure if we can improve further here? |
One possible improvement would be to fast-path a few cases. If the base class signature and the derived class signature have the same generic parameters and requirements, meaning the canonical signatures are equal, you don't need to create a GSB at all -- just return the base method's signature. |
Also, using getOverrideGenericSignature() in synthesizeDesignatedInitOverride() would probably help too. |
Follow up to #24484.
There was a small performance regression due to creating many more GSBs when computing the override generic signature of methods. This PR adds a cache to the AST to prevent
getOverrideGenericSignature
from re-computing the generic signature for methods each time.