Find Jackson ObjectMapper() allocations inside loops

Proprietary

Jackson's ObjectMapper is expensive to construct — it builds the default module and serializer registries on every allocation. Hoist a single ObjectMapper instance to a top-level property; it is thread-safe once configured.

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