Engineering Category: Zero-Copy Scanning, Parsing & Codec Primitives
Best Use in Production: High-throughput byte-slice scanning, delimiter discovery, and wire-safe ASCII/hex transcoding inside bounded 64KB memory pages.
When to Select This Capsule: Holds the #1 Equivalence Crown across 2 functionally identical implementations (fastest verified hardware _rdtsc). Sub-10-cycle hardware kernel (1500001/200000 cyc/op); safe for ultra-hot per-sample or per-packet inner loops.
Snap-Circuit Wiring Role: Slice Ingress / Scanner Stage `(&[u8],usize)->usize` — digests raw byte buffers into scalar tokens or checksums.
.text: 63 B (21 x86_64 insns)411 B)pub fn skip_utf8_char(bytes: &[u8], i: usize) -> usize {
if i >= bytes.len() {
return i;
}
let b = bytes[i];
if b < 0x80 {
return i + 1;
}
let len = if b & 0b1111_0000 == 0b1111_0000 {
4
} else if b & 0b1110_0000 == 0b1110_0000 {
3
} else if b & 0b1100_0000 == 0b1100_0000 {
2
} else {
1
};
(i + len).min(bytes.len())
}
rustc -C opt-level=3 x86_64 Disassembly (63 B .text / 21 insns)skip_utf8_char:
cmp rdx, rsi
jae .LBB7_7
movzx ecx, byte ptr [rdi + rdx]
test cl, cl
js .LBB7_2
inc rdx
.LBB7_7:
mov rax, rdx
ret
.LBB7_2:
mov eax, 4
cmp cl, -17
ja .LBB7_5
mov eax, 3
cmp cl, -32
jae .LBB7_5
cmp cl, -64
mov eax, 1
sbb rax, -1
.LBB7_5:
add rax, rdx
cmp rsi, rax
cmovb rax, rsi
ret
| Global Rank | Capsule & Domain | Hardware _rdtsc | Latency | Throughput | ELF .text | Ternary Vote | Author Aye |
|---|---|---|---|---|---|---|---|
| #640 | skip_utf8_char (THIS CAPSULE) domain: hoover-x86_64 | id: 6bd7862f1da208a4ccdcdeb53990512f | 1500001/200000 cyc/op | 1428697/400000 ns/op | 400000000/1428697 ops/us | 63 B .text (21 insns) | + (1) | aye::Hue+Gemini(0+1)::x86_64 @ 432Hz |
| #1230 | skip_ws domain: smart-tree | id: 5ceb292afe600d73b788cf4b16bc4b10 | 2090273/200000 cyc/op | 995651/200000 ns/op | 200000000/995651 ops/us | 60 B .text (14 insns) | + (1) | aye::Hue+Gemini(0+1)::x86_64 @ 432Hz |