mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Previously we recorded the canonical type of the declaration and made sure we could deserialize that, but that's a lot of extra work building up intermediate types that we mostly don't need. Instead, record smaller types that represent the possible points of failure--- right now, just the nominal types that are referenced by the value (function, variable/constant, subscript, or initializer). I chose to use types instead of declarations here because types can potentially encode more complicated constraints later (such as generic types checking that their arguments still conform). This gains us back 20% of type-checking time on a compile-time microbenchmark: `let _ = [1, 2]`. I expect the effect is less dramatic the more expressions you have, since we only need to deserialize things once.
45 KiB
45 KiB