Find expensive allocations on hot paths
ProprietarySearch-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$KtRecipemod 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.
- Find
Regexallocations inside loops - Find
Pattern.compileallocations inside loops - Find
SimpleDateFormatallocations inside loops - Find
DateTimeFormatter.ofPatternallocations inside loops - Find
BigDecimal("...")allocations inside loops - Find
BigInteger("...")allocations inside loops - Find
BigInteger.valueOf(long)calls inside loops - Find
Calendar.getInstance()calls inside loops - Find
Locale(...)allocations inside loops - Find
File(...).bufferedReader()calls inside loops - Find
URL("...")allocations inside loops - Find
URI("...")allocations inside loops - Find
Base64.getDecoder()calls inside loops - Find
Charset.forName(...)calls inside loops - Find
Optional.get()calls inside loops - Find
LoggerFactory.getLoggercalls inside loops - Find
Class.forNamecalls inside loops - Find
String.formatcalls inside loops - Find
MessageDigest.getInstancecalls inside loops - Find Jackson
ObjectMapper()allocations inside loops - Find
Gson()allocations inside loops - Find graphics allocations inside
View.onDraw - Find graphics allocations inside
View.onMeasure - Find graphics allocations inside
View.onLayout