perf: cache all info nodes by range along with variables' types - #235
Merged
Conversation
The local info table now stores all info, rather than just tactic info, reducing the number of traversals. Positioned syntax now looks in this table rather than traversing the tree. The signature cache also now has cached types of metavariable-free signatures.
This was referenced Aug 21, 2026
The type shown for a variable occurrence comes from that occurrence's own elaboration context: linked binders can differ in type across contexts, and the rendering depends on the names in scope and the pretty printer options in force at the occurrence.
A variable occurrence's hover is rendered from its fully instantiated type, the names in the occurrence's local context, and the pretty-printing context. The cache key consists of exactly these inputs, so linked occurrences of a binder whose types differ (such as the branches of a dependent if) each show the type from their own context. Types that still contain metavariables render fresh at each occurrence.
The names in a constant's hover signature abbreviate according to the namespace and open declarations in force where the constant is mentioned.
A constant's signature renders under the options, namespace, and open declarations of the occurrence being hovered, so the cache key pairs the constant's name with a hash of that context. Commands whose contexts agree still share the rendering work across a batch.
Up to and including 4.5, ppSignature renders only a declaration's type, without its name and binders, so the expected strings don't apply there.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The local info table now stores all info, rather than just tactic info, reducing the number of traversals. Positioned syntax now looks in this table rather than traversing the tree.
The signature cache also now has cached types of metavariable-free signatures.