TS: cache type IDs on type objects#594
Conversation
|
After re-running vscode:
|
|
LGTM. |
|
Turns out the tests are right, so I'll just write up the story here for posterity. Types can be extracted as "shallow" or "full". A fully-extracted type also has the type of its properties extracted. A type that is directly referenced from the AST gets fully extracted, whereas a type is shallow if it is only reachable through the unfolding of another type's properties. A type can transition from shallow to full if it was previously seen in shallow context, but then later it is found to be referenced in full context (e.g. it is the type of an expression). We detect the need for this transition in the However, when this transition was about to happen, the ID was simply found in the new cache and Fixing this is beyond the out of scope of what I thought was just a low-hanging fruit, so for now I'll just close this PR. |
Add barrier guard for comparison in Insufficient Key Size query
This speeds up full-mode extraction by caching the ID of a type on TypeScript type object, and checking the expansiveness cache a bit earlier. Type objects do not survive across different compiler instances, so the cache really is temporary and is not a replacement for any of the
Mapinstances stored on the type table.The benchmark for #479 showed TypeScript to be an outlier, in that full-mode had a 10X overhead on TypeScript, whereas other projects are closer to 2X. The larger impact on TypeScript is expected as a larger fraction of its time is spent extracting types.