-
Notifications
You must be signed in to change notification settings - Fork 104
Description
Currently, the allocation benchmark is running for a specified amount of time:
hermit-rs/benches/alloc/src/main.rs
Line 96 in 74b3621
| while bench_begin_time.elapsed().as_secs_f64() <= BENCH_DURATION { |
During this time, we do as many allocations and deallocations but do not deallocate everything to keep the allocator state interesting. This slowly grows the memory usage. Eventually, allocations fail. The benchmark handles manual allocation failures gracefully but pushes all results into different vectors, which will panic when the benchmark is run with little memory or on a fast machine.
This is the cause of hermit-os/kernel#2122, which was caused by the runners getting a little faster. The issue was worked around by increasing the memory.
Additionally, the benchmark uses fastrand for randomizing the allocations. The seed is never set, though, so two runs are never the same, which might increase benchmark variance by a bit.
Originally, the benchmark is from talc, where an arena is being benchmarked. In that context, pushing to vectors is not an issue, since they don't come from the arena.
For Hermit, this benchmark should be reworked. For example, by testing a given amount of allocations instead of a given amount of time and by setting a fastrand seed. A more thorough rework is also possible, though.