How Codeflash measures code runtime
Codeflash reports benchmarking results that look like this:- How we measure the runtime of code
- How we determine if an optimization is actually faster
- Why we measure the timing as best of N runs
- How we measure the runtime when we run on a wide variety of test cases.
Goals of Codeflash auto-benchmarking
A core principle of Codeflash is that it makes no assumptions about which optimizations might be faster. Instead, it generates multiple possible optimizations with LLMs and automatically benchmarks the code on a variety of inputs to empirically verify if the optimization is actually faster. The goals of Codeflash auto-benchmarking are:- Accurately measure the runtime of code
- Measure runtime for a wide variety of code
- Measure runtime on a variety of inputs
- Do all the above on a real machine, where other processes might be running and causing timing measurement noise
- Finally make a binary decision whether an optimization is faster or not