Use mapTo(mutableListOf(), f) instead of map(f).toMutableList()
Proprietarymap { f } allocates a List<R> and toMutableList copies it. mapTo(mutableListOf(), f) writes directly into the target without the intermediate.
org. openrewrite. kotlin. performance. UseMapToForMapToMutableList$KtRecipemod run . --recipe= 'org. openrewrite. kotlin. performance. UseMapToForMapToMutableList$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.