From 4eca708d8e693438d4e643dff7283f3cfb79d360 Mon Sep 17 00:00:00 2001 From: Mitya Selivanov Date: Mon, 27 Mar 2023 10:02:38 +0200 Subject: Benchmark multiple cycles --- ' | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 ' (limited to ''') diff --git a/' b/' new file mode 100644 index 0000000..438897f --- /dev/null +++ b/' @@ -0,0 +1,27 @@ +#define KIT_TEST_FILE foo +#include "../../kit_test/bench.h" + +struct test_foo_ { + double f; +}; + +BENCHMARK("foo") { + BENCHMARK_REPEAT(800); + + BENCHMARK_BEGIN; + { + int x = 0; + struct test_foo_ f = { 0. }; + + for (int i = 0; i < 100000; i++) { + x += (1 << 1); + x ^= i; + f.f += 0.1; + } + DO_NOT_OPTIMIZE(x); + DO_NOT_OPTIMIZE(f); + } + BENCHMARK_END; +} + +BENCHMARK("bar") { } -- cgit v1.2.3