From 377d73a55ba7bdbb1a47084c684fb1334b200f1b Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Wed, 12 Apr 2023 19:14:16 +0200 Subject: [PATCH] Add basic merge and nest benchmarks --- axum/benches/benches.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/axum/benches/benches.rs b/axum/benches/benches.rs index 50a7417b..c3b9c19e 100644 --- a/axum/benches/benches.rs +++ b/axum/benches/benches.rs @@ -19,7 +19,20 @@ fn main() { benchmark("minimal").run(Router::new); - benchmark("basic").run(|| Router::new().route("/", get(|| async { "Hello, World!" }))); + benchmark("basic") + .path("/a/b/c") + .run(|| Router::new().route("/a/b/c", get(|| async { "Hello, World!" }))); + + benchmark("basic-merge").path("/a/b/c").run(|| { + let inner = Router::new().route("/a/b/c", get(|| async { "Hello, World!" })); + Router::new().merge(inner) + }); + + benchmark("basic-nest").path("/a/b/c").run(|| { + let c = Router::new().route("/c", get(|| async { "Hello, World!" })); + let b = Router::new().nest("/b", c); + Router::new().nest("/a", b) + }); benchmark("routing").path("/foo/bar/baz").run(|| { let mut app = Router::new();