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: Sole canonical implementation for its 64-vector functional equivalence class. Sub-10-cycle hardware kernel (1320749/400000 cyc/op); safe for ultra-hot per-sample or per-packet inner loops.
Snap-Circuit Wiring Role: 2-to-1 Binary Combiner / Join Stage `(u64,u64)->u64` — ideal for merging two upstream DAG branches, dot products, or pairwise rank fusion.
.text: 70 B (20 x86_64 insns)386 B)#[inline(always)]
pub fn binary_search_eytzinger_u64(packed_sorted: u64, needle: u64) -> u64 {
let mut k: u32 = 1;
while k <= 7 {
let shift = (k - 1) * 8;
let val = (packed_sorted >> shift) & 0xFF;
let step = ((needle >= val) as u32) & 1;
k = (k << 1) + step;
}
let idx = (k >> (k.trailing_ones() + 1)).saturating_sub(1);
idx as u64
}
rustc -C opt-level=3 x86_64 Disassembly (70 B .text / 20 insns)binary_search_eytzinger_u64:
mov eax, 1
.LBB7_1:
lea ecx, [8*rax]
add cl, 56
mov rdx, rdi
shr rdx, cl
movzx ecx, dl
xor edx, edx
cmp rsi, rcx
setae dl
cmp eax, 4
lea eax, [rdx + 2*rax]
jb .LBB7_1
mov ecx, eax
not ecx
rep bsf ecx, ecx
inc cl
shr eax, cl
cmp eax, 1
adc eax, -1
ret
| Global Rank | Capsule & Domain | Hardware _rdtsc | Latency | Throughput | ELF .text | Ternary Vote | Author Aye |
|---|---|---|---|---|---|---|---|
| #37 | binary_search_eytzinger_u64 (THIS CAPSULE) domain: search | id: 5fc7c25762e754d9018729c322c172f1 | 1320749/400000 cyc/op | 1258209/800000 ns/op | 800000000/1258209 ops/us | 70 B .text (20 insns) | + (1) | aye::Hue+Gemini(0+1)::x86_64 @ 432Hz |