summaryrefslogtreecommitdiff
path: root/absl/container
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2022-09-14 07:12:47 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2022-09-14 07:13:31 -0700
commit4832049e5c050cd4b50182d0fc061b99bf64b4b6 (patch)
treed287f7011626892de9e54d6a17cc527447683b42 /absl/container
parent1be36c8a50e1c2aae525c0fa95cb300ecf9abbe4 (diff)
Add more options for `BM_iteration` in order to see better picture for choosing trade off for iteration optimizations.
``` BM_Iteration/1/1 1.83ns ± 0% BM_Iteration/2/2 2.63ns ±11% BM_Iteration/4/4 5.76ns ±26% BM_Iteration/7/7 3.79ns ± 0% BM_Iteration/10/10 8.49ns ±23% BM_Iteration/15/15 18.2ns ±30% BM_Iteration/16/16 21.2ns ±29% BM_Iteration/54/54 37.2ns ±21% BM_Iteration/100/100 74.7ns ±13% BM_Iteration/400/400 330ns ± 8% BM_Iteration/0/0 0.46ns ± 2% BM_Iteration/10/0 1.26ns ± 1% BM_Iteration/100/0 13.4ns ± 0% BM_Iteration/1000/0 417ns ± 0% BM_Iteration/10000/0 3.30µs ± 0% BM_Iteration/100/1 16.0ns ±12% BM_Iteration/1000/10 453ns ± 5% ``` PiperOrigin-RevId: 474282700 Change-Id: I4b3fcb80292147aa4a8f542ae5c7fc1e8bd5f05b
Diffstat (limited to 'absl/container')
-rw-r--r--absl/container/internal/raw_hash_set_benchmark.cc17
1 files changed, 16 insertions, 1 deletions
diff --git a/absl/container/internal/raw_hash_set_benchmark.cc b/absl/container/internal/raw_hash_set_benchmark.cc
index fdec769b..4c61d84c 100644
--- a/absl/container/internal/raw_hash_set_benchmark.cc
+++ b/absl/container/internal/raw_hash_set_benchmark.cc
@@ -12,7 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+#include <array>
+#include <cmath>
#include <numeric>
+#include <utility>
#include <random>
#include <vector>
@@ -235,10 +238,22 @@ void BM_Iteration(benchmark::State& state) {
}
BENCHMARK(BM_Iteration)
+ ->ArgPair(1, 1)
+ ->ArgPair(2, 2)
+ ->ArgPair(4, 4)
+ ->ArgPair(7, 7)
->ArgPair(10, 10)
- ->ArgPair(20, 20)
+ ->ArgPair(15, 15)
+ ->ArgPair(16, 16)
+ ->ArgPair(54, 54)
->ArgPair(100, 100)
->ArgPair(400, 400)
+ // empty
+ ->ArgPair(0, 0)
+ ->ArgPair(10, 0)
+ ->ArgPair(100, 0)
+ ->ArgPair(1000, 0)
+ ->ArgPair(10000, 0)
// sparse
->ArgPair(100, 1)
->ArgPair(1000, 10);