80d35758d5
When converting a `schema.InputType` to a `model.Type`, calculate the resolved form of the type in the schema type system rather than the model type system. The results are semantically identical, but the number of type objects that are allocated is much smaller b/c `model.NewOutputType` no longer allocates. This deserves a little more explanation. In order to prevent nested outputs and/or promises, `model.NewOutputType` calculates the resolved form of its argument prior to allocating a new `OutputType` value. Calculating the resolved form of the argument is a no-op if the argument is already fully resolved. Therefore, passing in a fully-resolved schema type prevents `model.NewOutputType` from calulating the resolved form, and `model.NewOutputType` will only allocate the `OutputType` itself instead of the `OutputType` and the resolved form of any eventuals present in its argument. This has a _very important_ knock-on benefit: the schema -> model type translator ensures that given a `schema.Type` instance `T` it will always return the same `model.Type` instance `U`. This termendously speeds up type equality checks for complex types, as they will now be referentially identical. This change alone gives a significant speedup in azure-native code generation. |
||
---|---|---|
.. | ||
backend | ||
cmd/pulumi | ||
codegen | ||
engine | ||
graph | ||
operations | ||
resource | ||
secrets | ||
testing/integration | ||
util | ||
version | ||
go.mod | ||
go.sum |