Organize benchmarks and introduce 'size' dimension#1007
Organize benchmarks and introduce 'size' dimension#1007ludfjig merged 1 commit intohyperlight-dev:mainfrom
Conversation
46942d2 to
862c136
Compare
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
862c136 to
3b6e295
Compare
There was a problem hiding this comment.
This looks great!
I know this is not part of the changes but there are some tests that could benefit from using iter_batched to avoid measuring expensive setup. An example of this is guest_call_with_large_parameters that is cloning huge data in measure loop and could be rewritten as:
b.iter_batched(
|| (large_vec.clone(), large_string.clone()),
|(vec, string)| {
sandbox.call::<()>("LargeParameters", (vec, string)).unwrap()
},
criterion::BatchSize::SmallInput,
);I think this is important because if the time spent on test setup dominates the total measured time (e.g 90%), then only a small fraction of the benchmark reflects the actual code we want to measure. This makes it hard to detect meaningful performance changes, because any improvements or regressions are drowned out by the setup overhead of cloning so we should pay extra attention if we want to maintain meaningful measuremens -- sorry for the offtopic :-)
You are totally right! We should fix this! |
Many of our benchmarks exhibit different performance characteristics depending on the size of the sandbox. This PR restructures the benchmark suite to run relevant benchmarks across four different heap sizes (default, 8MB, 64MB, 256MB), providing better visibility into how performance scales with memory allocation. This PR increases the number of benchmarks which will increase CI benchmark execution time proportionally.
Also slightly reorganizes the benchmarks into better categories. The multiple consecutive for-loops over sizes might seem weird at first, but it makes sure
cargo benchruns the same benchmark with all sizes before moving on to the next benchmark.cargo bench -- --listnow yields the following:Also adds the
snapshots/createandsnapshots/restorebenchmarks, which are usefulCloses #722