-
Notifications
You must be signed in to change notification settings - Fork 128
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
Store only the resolved reference in DocumentationContext.symbolIndex #543
Store only the resolved reference in DocumentationContext.symbolIndex #543
Conversation
In my local benchmarking across two different machines this lowers peak memory usage by ~1.5% while also making small improvements to the total covert time:
|
@swift-ci please test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice find! Is there a test that we can write that asserts that the references from the different stores are the consistent? Similar to https://github.com/apple/swift-docc/blob/c74237d83e542864033e0194b8f4bdf553c12485/Tests/SwiftDocCTests/Infrastructure/DocumentationContext/DocumentationContextTests.swift#L3282
Good idea. I think that'd be easy to test with one of the test bundles. |
@swift-ci please test |
…swiftlang#543) * Store only the resolved reference in DocumentationContext.symbolIndex rdar://106654403 * Add test that references in symbol index have nodes in doc cache
Bug/issue #, if applicable: rdar://106654403
Summary
This changes
DocumentationContext.symbolIndex
from a lookup that returnDocumentationNode
values to a lookup that returnResolvedTopicReference
values.Storing all nodes both in the documentation cache and in the symbol index makes it easy to accidentally hold on to old versions of nodes if the value in the documentation cache is updated without also updating the value in the symbol index. By instead only storing the node's resolved reference in the symbol cache and using it to find the node in the documentation cache, various places in the code that modify documentation nodes only need to update the value in one place.
This makes up for the previous peak memory usage increase from #498 (comment).
Dependencies
None.
Testing
None. This is a non-functional change. Everything should continue to work the same as before.
Checklist
Make sure you check off the following items. If they cannot be completed, provide a reason.
./bin/test
script and it succeeded