-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Performance issues with blocktoattr.ExpandedVariables and Block.DecoderSpec #25889
Description
Resources with large, deeply nested schemas can cause blocktoattr.ExpandedVariables to take a relatively large amount of time to execute.
For example, the aws_wafv2_web_acl which has a combined total of 2878 blocks at the moment, takes many seconds to process the potential references from the configuration.
There are 2 pieces that may need to be optimized here:
-
The
blocktoattr.ExpandedVariablescallsschema.DecoderSpec()for each block as it recurses through the schema, butschema.DecoderSpec()is also recursive and re-evaluates each child block even though the result is only used for the current level of recursion. -
The
schema.DecoderSpec()call itself is relatively slow, taking ~1s for the top-level call onaws_wafv2_web_aclwith my test machine.