As explained in https://github.com/terraform-linters/tflint/issues/1943, inspections on module calls are performed sequentially, which can be slow if there are many calls. This PR improves speed by processing in parallel with goroutines.
This can be expected to speed up when you have many module calls. For example, with 50 module calls, we observed the following improvements:
$ time tflint
real 0m0.774s
user 0m0.897s
sys 0m0.319s
$ time tflint --no-parallel-runners
real 0m1.591s
user 0m1.747s
sys 0m1.815s
Although the above improvement is small, it can be effective when inspecting many modules with recursive inspections.
Note that the inspection against the root module is not parallelized for goroutine-safety. The root module runner may be referenced from module calls, so it is not safe to share it between multiple goroutines, assuming autofix-like side effects. I believe there are no other unsafe operations like this, but just in case I'm adding the --no-parallel-runners flag for debugging.
See https://github.com/terraform-linters/tflint/issues/1943
As explained in https://github.com/terraform-linters/tflint/issues/1943, inspections on module calls are performed sequentially, which can be slow if there are many calls. This PR improves speed by processing in parallel with goroutines.
This can be expected to speed up when you have many module calls. For example, with 50 module calls, we observed the following improvements:
Although the above improvement is small, it can be effective when inspecting many modules with recursive inspections.
Note that the inspection against the root module is not parallelized for goroutine-safety. The root module runner may be referenced from module calls, so it is not safe to share it between multiple goroutines, assuming autofix-like side effects. I believe there are no other unsafe operations like this, but just in case I'm adding the
--no-parallel-runners
flag for debugging.