diff --git a/README.md b/README.md index f5fb0a1..e5fab4c 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ implementations compare to each other. | grep | 0m18.034s | 0m15.713s | 0m2.257s | | ripgrep | 0m1.709s | 0m1.541s | 0m0.147s | | simple (Go) | 0m1.889s | 0m1.679s | 0m0.211s | -| simple (Rust) | 0m2.169s | 0m1.943s | 0m0.219s | +| simple (Rust) | 0m1.623s | 0m1.415s | 0m0.204s | | simple (Node) | 0m6.458s | 0m6.043s | 0m0.627s | | custom (C) | **0m0.222s** | **0m0.079s** | **0m0.141s** | diff --git a/main.rs b/main.rs index 87b13c6..f9540b6 100644 --- a/main.rs +++ b/main.rs @@ -26,7 +26,7 @@ fn scan_slice(inb: &[u8]) -> usize { let mut count = 0; let len = inb.len(); for (i, &b) in inb.into_iter().enumerate() { - if b >= b'0' && b <= b'9' || b >= b'a' && b <= b'f' { + if b.is_ascii_digit() || (b'a'..=b'f').contains(&b) { count += 1; continue }