From d9d7cf9b87a9796c5ac4d6d954566ec3bbadfa43 Mon Sep 17 00:00:00 2001 From: Zhijian Jiang Date: Thu, 5 Dec 2024 21:49:41 -0800 Subject: [PATCH] explains how folly benchmark decides how many iterations to run and how to tune it (#2348) Summary: I spent some time to figure this out and it should be beneficial to mention that in the doc Differential Revision: D66708725 --- folly/docs/Benchmark.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/folly/docs/Benchmark.md b/folly/docs/Benchmark.md index 2ddd2c8d814..98b900950e0 100644 --- a/folly/docs/Benchmark.md +++ b/folly/docs/Benchmark.md @@ -61,8 +61,11 @@ about it. Sometimes the function itself would want to do that iteration---for example how about inserting `n` elements instead of 100 elements? To do the iteration internally, use `BENCHMARK` with two parameters. The second parameter is the number of iterations and is -passed by the framework down to the function. The type of the count is -implicitly `unsigned`. Consider a slightly reworked example: +passed by the framework down to the function (folly benchmark runs as many as +iterations until the time spent exceeds a threshold defined in the code. +To increase iterations, especially for high-latency methods, adjust the `bm_min_usec` flag +and `bm_max_secs` flag to allow higher time budget. Or adjust `bm_min_iters` to increase the minium iterations.). +The type of the count is implicitly `unsigned`. Consider a slightly reworked example: ``` Cpp #include