From 00000290ebbb28a49ab8a23ab38eeda83b42af70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Jane=C5=BEi=C4=8D?= Date: Sat, 21 Dec 2024 21:29:04 +0100 Subject: [PATCH] perf: cache bfs for day 21 --- src/bin/21.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/bin/21.rs b/src/bin/21.rs index 0792491..743773a 100644 --- a/src/bin/21.rs +++ b/src/bin/21.rs @@ -32,6 +32,11 @@ const KEYPAD: [(u8, [Option<(u8, u8)>; 3]); 5] = [ (b'A', [Some((b'^', b'<')), Some((b'>', b'v')), None]), ]; +#[cached( + ty = "SizedCache>>", + create = "{ SizedCache::with_size(150) }", + convert = r#"{ format!("{}{s}{e}", graph.len()) }"# +)] fn bfs(graph: &HashMap>, s: u8, e: u8) -> Vec> { let mut res = Vec::new();