From ad7ca5d592b22ad41eafc74bcad1869be946c7ee Mon Sep 17 00:00:00 2001 From: alion02 Date: Fri, 20 Dec 2024 00:37:55 +0100 Subject: [PATCH] get profiling --- src/day19.rs | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/src/day19.rs b/src/day19.rs index 7c719f4..530eac3 100644 --- a/src/day19.rs +++ b/src/day19.rs @@ -21,32 +21,35 @@ unsafe fn inner1(s: &[u8]) -> u32 { }; } - loop { - let mut hash = hash!(*ptr); - let mut curr = 0; - loop { - ptr = ptr.add(1); - let next = trie.add(curr).cast::().add(hash as usize); - if *next == 0 { - len += 1; - *next = len; - *trie.add(len as usize) = [0; 6]; + ({ + #[inline(never)] + || loop { + let mut hash = hash!(*ptr); + let mut curr = 0; + loop { + ptr = ptr.add(1); + let next = trie.add(curr).cast::().add(hash as usize); + if *next == 0 { + len += 1; + *next = len; + *trie.add(len as usize) = [0; 6]; + } + + hash = hash!(*ptr); + curr = *next as usize; + if (hash as i32) < 0 { + break; + } } - hash = hash!(*ptr); - curr = *next as usize; - if (hash as i32) < 0 { + ptr = ptr.add(2); + assert!(*ptr > 64); + *trie.add(curr).cast::().add(2) = 1; + if is_lf!(hash) { break; } } - - ptr = ptr.add(2); - assert!(*ptr > 64); - *trie.add(curr).cast::().add(2) = 1; - if is_lf!(hash) { - break; - } - } + })(); let mut total = 0;