Skip to main content

bench_main

Macro bench_main 

Source
macro_rules! bench_main {
    (allocator = none; $($groups:tt)*) => { ... };
    (allocator = $allocator:path; $($groups:tt)*) => { ... };
    ($($groups:tt)*) => { ... };
}
Expand description

Defines the entry point for GPUI Criterion benchmark groups.

This mirrors criterion::criterion_main! so GPUI benchmark files can keep the same shape as ordinary Criterion benchmarks. It also installs CountingAllocator as the binary’s global allocator, so reports include heap allocations per iteration. It wraps the system allocator by default; allocator = Path; wraps another unit-struct allocator instead, e.g. to compare allocators, which pay the same small counting cost:

ⓘ
gpui::bench_main!(allocator = mimalloc::MiMalloc; benches);

allocator = none; installs no global allocator, leaving Rust’s default and dropping the allocation metrics from reports.