From 2805a0515461d6f70f7d4a6c1f5491dbed5d61b8 Mon Sep 17 00:00:00 2001 From: est31 Date: Fri, 18 Sep 2020 05:52:45 +0200 Subject: [PATCH] Add bench_typed_arena_clear_100 bench --- compiler/rustc_arena/src/tests.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/compiler/rustc_arena/src/tests.rs b/compiler/rustc_arena/src/tests.rs index 8e63bdf5458..e8a1f2db1a1 100644 --- a/compiler/rustc_arena/src/tests.rs +++ b/compiler/rustc_arena/src/tests.rs @@ -121,6 +121,17 @@ pub fn bench_typed_arena_clear(b: &mut Bencher) { }) } +#[bench] +pub fn bench_typed_arena_clear_100(b: &mut Bencher) { + let mut arena = TypedArena::default(); + b.iter(|| { + for _ in 0..100 { + arena.alloc(Point { x: 1, y: 2, z: 3 }); + } + arena.clear(); + }) +} + // Drop tests struct DropCounter<'a> {