From 47f75563aebcd9b0eed380a42618cf253df20823 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20K=C3=A4nner?= Date: Tue, 21 Jan 2025 20:21:23 +0100 Subject: [PATCH] add clone benchmark --- battlesnake/benches/simulation.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/battlesnake/benches/simulation.rs b/battlesnake/benches/simulation.rs index e2ff45d..5316314 100644 --- a/battlesnake/benches/simulation.rs +++ b/battlesnake/benches/simulation.rs @@ -216,5 +216,17 @@ fn constrictor(c: &mut Criterion) { } } -criterion_group!(benches, standard, constrictor); +fn clone(c: &mut Criterion) { + let request = create_standard_start_request([ + Coord { x: 1, y: 1 }, + Coord { x: 9, y: 1 }, + Coord { x: 1, y: 9 }, + Coord { x: 9, y: 9 }, + ]); + let board = Board::from(&request); + + c.bench_function("clone", |b| b.iter(|| board.clone())); +} + +criterion_group!(benches, standard, constrictor, clone); criterion_main!(benches);