-
Notifications
You must be signed in to change notification settings - Fork 322
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c080d97
commit 798a247
Showing
3 changed files
with
30 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,25 @@ | ||
use criterion::{black_box, criterion_group, criterion_main, Criterion}; | ||
use http_types::Method; | ||
use tide::router::Router; | ||
// use criterion::{black_box, criterion_group, criterion_main, Criterion}; | ||
// use http_types::Method; | ||
// use tide::router::Router; | ||
|
||
fn criterion_benchmark(c: &mut Criterion) { | ||
let mut router = Router::<()>::new(); | ||
router.add( | ||
"hello", | ||
Method::Get, | ||
Box::new(|_| async { Ok("hello world") }), | ||
); | ||
// fn criterion_benchmark(c: &mut Criterion) { | ||
// let mut router = Router::<()>::new(); | ||
// router.add( | ||
// "hello", | ||
// Method::Get, | ||
// Box::new(|_| async { Ok("hello world") }), | ||
// ); | ||
|
||
c.bench_function("route-match", |b| { | ||
b.iter(|| black_box(router.route("/hello", Method::Get))) | ||
}); | ||
// c.bench_function("route-match", |b| { | ||
// b.iter(|| black_box(router.route("/hello", Method::Get))) | ||
// }); | ||
|
||
c.bench_function("route-root", |b| { | ||
b.iter(|| black_box(router.route("", Method::Get))) | ||
}); | ||
} | ||
// c.bench_function("route-root", |b| { | ||
// b.iter(|| black_box(router.route("", Method::Get))) | ||
// }); | ||
// } | ||
|
||
criterion_group!(benches, criterion_benchmark); | ||
criterion_main!(benches); | ||
// criterion_group!(benches, criterion_benchmark); | ||
// criterion_main!(benches); | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters