Find expensive allocations inside collection lambdas

Proprietary

Search-only recipes that flag heavyweight allocations sitting inside the trailing lambda of a map / filter / forEach / flatMap call. Each such lambda runs once per element — the same allocation-cost profile as a loop body.

org.openrewrite.kotlin.performance.FindAllocationsInCollectionLambdas$KtRecipe
mod run . --recipe='org.openrewrite.kotlin.performance.FindAllocationsInCollectionLambdas$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.

Recipe list

It runs these recipes, in this order.

  1. Find Regex allocations inside collection lambdas
  2. Find Pattern.compile calls inside collection lambdas
  3. Find String.format calls inside collection lambdas
  4. Find LoggerFactory.getLogger calls inside collection lambdas
  5. Find Jackson ObjectMapper() allocations inside collection lambdas
  6. Find Gson() allocations inside collection lambdas