mirror of
https://github.com/tokio-rs/axum.git
synced 2024-11-21 22:56:46 +01:00
Add basic merge and nest benchmarks
This commit is contained in:
parent
cf1ed9bb54
commit
377d73a55b
1 changed files with 14 additions and 1 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue