Find Pattern.compile allocations inside loops
ProprietaryCompiling a java.util.regex.Pattern is expensive — allocating one inside a loop recompiles it on every iteration. Hoist the Pattern out of the loop or cache it in a top-level property.
org. openrewrite. kotlin. performance. FindPatternCompileInLoops$KtRecipemod run . --recipe= 'org. openrewrite. kotlin. performance. FindPatternCompileInLoops$KtRecipe'Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.