Find File(...).bufferedReader() calls inside loops

Proprietary

Constructing a File and opening a BufferedReader per loop iteration multiplies the OS-level open/read/close cost. If the same path is read each pass, read it once before the loop; if every iteration reads a different path, batch the work or reuse a Reader.

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