Skip to content

Commit 24d5108

Browse files
authored
Merge pull request #671 from elbeno/clean-parse
🐛 Fix up benchmark code
2 parents eb8b788 + c3c4c8c commit 24d5108

File tree

6 files changed

+43
-10
lines changed

6 files changed

+43
-10
lines changed

benchmark/lookup/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,12 @@ function(gen_pp_benchmarks)
9191
cib_lookup
9292
mph
9393
frozen-headers)
94-
target_compile_options(${name} PRIVATE -fconstexpr-steps=4000000000
95-
--include=${HEADER})
94+
target_compile_options(
95+
${name}
96+
PRIVATE
97+
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-fconstexpr-steps=4000000000>
98+
$<$<CXX_COMPILER_ID:GNU>:-fconstexpr-ops-limit=4000000000>
99+
--include=${HEADER})
96100
target_compile_definitions(
97101
${name} PRIVATE ALG_NAME=bench_${ALG_NAME} DATASET=${DATASET}
98102
ANKERL_NANOBENCH_IMPLEMENT)

benchmark/lookup/algorithms/pseudo_pext.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ template <auto data, typename T, bool indirect = true,
2626
std::size_t max_search_len = 2>
2727
constexpr auto make_pseudo_pext() {
2828
return lookup::pseudo_pext_lookup<indirect, max_search_len>::make(
29-
CX_VALUE(lookup::input{0, pp::input_data<data, T>}));
29+
CX_VALUE(lookup::input<T, T, data.size()>{0, pp::input_data<data, T>}));
3030
}
3131

3232
template <auto data, typename T, bool indirect = true,

benchmark/msg/CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
add_benchmark(handler_bench NANO FILES handler_bench.cpp SYSTEM_LIBRARIES cib)
2-
target_compile_options(handler_bench PRIVATE -fconstexpr-steps=4000000000
3-
-fbracket-depth=1024)
2+
target_compile_options(
3+
handler_bench
4+
PRIVATE
5+
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-fconstexpr-steps=4000000000>
6+
$<$<CXX_COMPILER_ID:GNU>:-fconstexpr-ops-limit=4000000000>
7+
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-fbracket-depth=1024>
8+
)

tools/benchmark/gen_map_data.py

100644100755
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/usr/bin/env python3
2+
13
import argparse
24
import random
35

tools/benchmark/parse_bench_data.py

100644100755
Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#!/usr/bin/env python3
2+
3+
import argparse
14
import csv
25
import re
36

@@ -72,9 +75,28 @@ def generate_csv_tables(data, output_prefix):
7275
writer.writerow(row)
7376

7477

75-
# Usage example
76-
file_path = 'bench_output2.txt'
77-
output_prefix = 'output'
78+
def parse_cmdline():
79+
parser = argparse.ArgumentParser()
80+
parser.add_argument(
81+
"--input",
82+
type=str,
83+
required=True,
84+
help=("Path to the input results."),
85+
)
86+
parser.add_argument(
87+
"--output_prefix",
88+
type=str,
89+
required=True,
90+
help="Output filename prefix for the generated CSV file.",
91+
)
92+
return parser.parse_args()
93+
94+
95+
def main():
96+
args = parse_cmdline()
97+
data = parse_file(args.input)
98+
generate_csv_tables(data, args.output_prefix)
99+
78100

79-
data = parse_file(file_path)
80-
generate_csv_tables(data, output_prefix)
101+
if __name__ == "__main__":
102+
main()

tools/gen_release_header.py

100644100755
File mode changed.

0 commit comments

Comments
 (0)