Find expensive allocations on hot paths

Proprietary

Search-only recipes that flag heavyweight allocations sitting on a path the runtime exercises repeatedly — inside a loop, inside View.onDraw/onMeasure/onLayout. Each match shows up as a SearchResult for review; nothing is rewritten automatically.

org.openrewrite.kotlin.performance.FindAllocationsInHotPaths$KtRecipe
mod run . --recipe='org.openrewrite.kotlin.performance.FindAllocationsInHotPaths$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 loops
  2. Find Pattern.compile allocations inside loops
  3. Find SimpleDateFormat allocations inside loops
  4. Find DateTimeFormatter.ofPattern allocations inside loops
  5. Find BigDecimal("...") allocations inside loops
  6. Find BigInteger("...") allocations inside loops
  7. Find BigInteger.valueOf(long) calls inside loops
  8. Find Calendar.getInstance() calls inside loops
  9. Find Locale(...) allocations inside loops
  10. Find File(...).bufferedReader() calls inside loops
  11. Find URL("...") allocations inside loops
  12. Find URI("...") allocations inside loops
  13. Find Base64.getDecoder() calls inside loops
  14. Find Charset.forName(...) calls inside loops
  15. Find Optional.get() calls inside loops
  16. Find LoggerFactory.getLogger calls inside loops
  17. Find Class.forName calls inside loops
  18. Find String.format calls inside loops
  19. Find MessageDigest.getInstance calls inside loops
  20. Find Jackson ObjectMapper() allocations inside loops
  21. Find Gson() allocations inside loops
  22. Find graphics allocations inside View.onDraw
  23. Find graphics allocations inside View.onMeasure
  24. Find graphics allocations inside View.onLayout