

bench
High Precision Timing of R Expressions
bench is a high-precision benchmarking package for R that measures code execution time, memory allocations, and garbage collection activity. It provides tools to compare the performance of different expressions and ensure they produce equivalent results.
The package uses the highest precision timing APIs available on each operating system and implements adaptive stopping to run expressions for a set duration rather than a fixed number of iterations. It filters out iterations affected by garbage collection to provide more accurate measurements, includes bench::press() for benchmarking across parameter grids, and returns results with human-readable units and built-in ggplot2 plotting support. The package verifies that compared expressions produce equal results by default, preventing accidental comparison of non-equivalent code.



