snoop: bug of benchmark buffer size
tezt/snoop/main.exe
fails with a reduced number of benchmarks. (I need run the program with a reduced number of benchmarks to test snoop quickly.)
How to reproduce the issue:
- Changed
default_bench_num
at https://gitlab.com/tezos/tezos/-/blob/2ccf5c8ddb81587fa4fe73116f5743c5b5b606b9/tezt/snoop/perform_benchmarks.ml#L31 , say 5 - Recompile then run
dune exec tezt/snoop/main.exe -- --verbose
- Program fails with an out-of-bound index error at https://gitlab.com/tezos/tezos/-/blob/2ccf5c8ddb81587fa4fe73116f5743c5b5b606b9/src/lib_benchmark/measure.ml#L428
Cause:
This is because benchmarks
generated at https://gitlab.com/tezos/tezos/-/blob/2ccf5c8ddb81587fa4fe73116f5743c5b5b606b9/src/lib_benchmark/measure.ml#L512 can be larger than options.bench_number
.
For example, create_benchmarks
for KINSTR_SIZE at https://gitlab.com/tezos/tezos/-/blob/2ccf5c8ddb81587fa4fe73116f5743c5b5b606b9/src/proto_alpha/lib_benchmarks_proto/script_typed_ir_size_benchmarks.ml#L113 ignores bench_num
if the data file is specified.
FYI, the benchmark generation for "ISapling_verify_update" at https://gitlab.com/tezos/tezos/-/blob/2ccf5c8ddb81587fa4fe73116f5743c5b5b606b9/src/proto_alpha/lib_benchmarks_proto/interpreter_benchmarks.ml#L2578 properly fix the number of the benchmarks.
Possible fix:
I do not know it is a good fix or not, but so far I make benchmarks
shorter when https://gitlab.com/tezos/tezos/-/blob/2ccf5c8ddb81587fa4fe73116f5743c5b5b606b9/src/lib_benchmark/measure.ml#L512 returns a list larger than options.bench_number
.