CompilerConfiguration with ImportCustomizer gets applied once per class in a source unit. If unit has a lot of classes this can cause a lot of extra imports processing.CompilationUnit.applyToPrimaryClassNodes(PrimaryClassNodeOperation) is the loop that drives the CompilationCustomizers. org.codehaus.groovy.control.customizers.ImportCustomizer.call is where imports are added. Could check if ClassNode param is the primary class in the module before applying. Or ModuleNode could allow addImport and just dedup internally.