Skip to content

Commit

Permalink
update benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
ibraheemdev committed Feb 27, 2024
1 parent a9d6be8 commit 63de931
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fn compare_routers(c: &mut Criterion) {
let mut group = c.benchmark_group("Compare Routers");

let mut matchit = matchit::Router::new();
for route in register!(colon) {
for route in register!(brackets) {
matchit.insert(route, true).unwrap();
}
group.bench_function("matchit", |b| {
Expand Down
8 changes: 4 additions & 4 deletions src/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -652,25 +652,25 @@ impl<T> Default for Node<T> {
#[cfg(test)]
const _: () = {
use std::fmt::{self, Debug, Formatter};

// visualize the tree structure when debugging
impl<T: Debug> Debug for Node<T> {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
// safety: we only expose &mut T through &mut self
let value = unsafe { self.value.as_ref().map(|x| &*x.get()) };

let indices = self
.indices
.iter()
.map(|&x| char::from_u32(x as _))
.collect::<Vec<_>>();

let param_names = self
.param_remapping
.iter()
.map(|x| std::str::from_utf8(x).unwrap())
.collect::<Vec<_>>();

let mut fmt = f.debug_struct("Node");
fmt.field("value", &value);
fmt.field("prefix", &std::str::from_utf8(&self.prefix));
Expand Down

0 comments on commit 63de931

Please sign in to comment.