Best Use & Engineering Application Guide

Engineering Category: Hybrid Retrieval, Ranking & Entropy

Best Use in Production: Branchless integer similarity scoring, edit-distance evaluation, and candidate ranking for high-throughput retrieval pipelines.

When to Select This Capsule: Holds the #1 Equivalence Crown across 2 functionally identical implementations (fastest verified hardware _rdtsc). Sub-10-cycle hardware kernel (961493/100000 cyc/op); safe for ultra-hot per-sample or per-packet inner loops.

Snap-Circuit Wiring Role: Specialized Multi-Pin Stage `(u64,u64,u64)->u64` — wire matching input pins via `snap_dag` or `snap_pipeline`.

Hardware _rdtsc: 961493/100000 cycles/op
Latency: 260847/100000 ns/op
Throughput: 100000000/260847 ops/us
Compiled ELF64 .text: 121 B (35 x86_64 insns)
C64 64KB RAM Budget: 437/65536 (437 B source)
Ternary Vote: + (score 1) | Salience: 37265/416
Pure-Rust Capsule Source Code (437 B)
pub const fn st_golf_searchix_bm25_option_rank_q15_u64(term_freq: u64, doc_len: u64, exact_prefix_match: u64) -> u64 {
    if term_freq == 0 {
        return 0;
    }
    let dl4 = (if doc_len < 8 { 8 } else { doc_len }) >> 2;
    let tf_q15 = term_freq.saturating_mul(32768) / term_freq.saturating_add(dl4);
    let score = tf_q15.saturating_add(((exact_prefix_match != 0) as u64) << 14);
    if score > 65535 { 65535 } else { score }
}
rustc -C opt-level=3 x86_64 Disassembly (121 B .text / 35 insns)
st_golf_searchix_bm25_option_rank_q15_u64:
    test    rdi, rdi
    je    .LBB7_3
    mov    rcx, rdx
    cmp    rsi, 9
    mov    edx, 8
    cmovae    rdx, rsi
    shr    rdx, 2
    mov    rax, rdi
    shr    rax, 49
    jne    .LBB7_4
    mov    rax, rdi
    shl    rax, 15
.LBB7_5:
    add    rdi, rdx
    mov    rsi, -1
    cmovae    rsi, rdi
    mov    rdx, rax
    or    rdx, rsi
    shr    rdx, 32
    je    .LBB7_6
    xor    edx, edx
    div    rsi
    jmp    .LBB7_8
.LBB7_3:
    xor    eax, eax
    ret
.LBB7_6:
    xor    edx, edx
    div    esi
.LBB7_8:
    lea    rdx, [rax + 16384]
    test    rcx, rcx
    cmove    rdx, rax
    cmp    rdx, 65535
    mov    eax, 65535
    cmovb    rax, rdx
    ret
.LBB7_4:
    mov    rax, -1
    jmp    .LBB7_5

Head-to-Head Functional Equivalence Class Peers (2 Implementation(s) Matching 64 Test Vectors)

Global RankCapsule & DomainHardware _rdtscLatencyThroughputELF .textTernary VoteAuthor Aye
#77st_golf_searchix_bm25_option_rank_q15_u64 (THIS CAPSULE)
domain: searchix-bm25 | id: 9446db816a447a32f26b8608fb2f8d42
961493/100000 cyc/op260847/100000 ns/op100000000/260847 ops/us121 B .text (35 insns)+ (1)aye::Hue+Gemini(0+1)::x86_64 @ 432Hz
#1530searchix_bm25_option_rank_q15
domain: routing | id: e7922cf22041b9ed414fcb5a33d8df90
4684317/400000 cyc/op1514363/400000 ns/op400000000/1514363 ops/us121 B .text (35 insns)0 (0)aye-aurora-8b-voice @ 432Hz