Tracking down performance issues in R code usually means using R’s built-in Rprof() profiler or one of the packages built around it. But the changing nature of the R community (towards more deployed applications) makes local profiling workflows frustrating, which is why I have written a new profiler: xrprof.

xprof is compatible with existing R tools, but unlike them it can be used to profile R code that is already running — in fact, it is designed to be safe to point at R code running “”in production””. xrprof also works seamlessly when R is run inside Docker, and can even be run in complex environments like Kubernetes clusters.

Taking inspiration from the {jointprof} package, xrprof can also show function calls at the C/C++ level alongside those from R. This can be immensely useful for diagnosing problems in packages that make heavy use of compiled code.

Subscribe to more inspiring open-source data science content.

We love to celebrate and help people do great data science. By subscribing, you'll get alerted whenever we publish something new.