Best Use & Engineering Application Guide

Engineering Category: Marine Salience & Wave Telemetry

Best Use in Production: Tracking period and amplitude stability across zero-crossing intervals to score signal salience in noisy real-time sensor and audio streams.

When to Select This Capsule: Sole canonical implementation for its 64-vector functional equivalence class. Multi-step compute kernel (8868949/200000 cyc/op); best used at frame, block, or batch aggregation boundaries.

Snap-Circuit Wiring Role: Slice Ingress / Scanner Stage `(&[u8])->u16` — digests raw byte buffers into scalar tokens or checksums.

Hardware _rdtsc: 8868949/200000 cycles/op
Latency: 4811971/400000 ns/op
Throughput: 400000000/4811971 ops/us
Compiled ELF64 .text: 322 B (87 x86_64 insns)
C64 64KB RAM Budget: 919/65536 (919 B source)
Ternary Vote: + (score 1) | Salience: 9912745/115596
Pure-Rust Capsule Source Code (919 B)
pub fn score_chunk_salience_q15(bytes: &[u8]) -> u16 {
    if bytes.is_empty() {
        return 0;
    }
    let mut seen = [false; 256];
    let mut unique = 0_u32;
    let mut struct_marks = 0_u32;
    let mut transitions = 0_u32;
    let mut prev = bytes[0];
    for &b in bytes {
        if !seen[b as usize] {
            seen[b as usize] = true;
            unique += 1;
        }
        if matches!(b, b'#' | b'=' | b':' | b'{' | b'}' | b'/' | b'-' | b'>') {
            struct_marks += 1;
        }
        if b != prev {
            transitions += 1;
        }
        prev = b;
    }
    let n = bytes.len() as u32;
    let diversity_q15 = ((unique.min(96) * 16_384) / 96) as i32;
    let trans_q15 = ((transitions * 10_000) / n.max(1)).min(10_000) as i32;
    let struct_q15 = ((struct_marks * 6_383 * 12) / n.max(1)).min(6_383) as i32;
    (diversity_q15 + trans_q15 + struct_q15).clamp(0, 32_767) as u16
}
rustc -C opt-level=3 x86_64 Disassembly (322 B .text / 87 insns)
score_chunk_salience_q15:
    xor    eax, eax
    test    rsi, rsi
    je    .LBB7_12
    push    rbp
    push    rbx
    sub    rsp, 136
    xorps    xmm0, xmm0
    movaps    xmmword ptr [rsp + 112], xmm0
    movaps    xmmword ptr [rsp + 96], xmm0
    movaps    xmmword ptr [rsp + 80], xmm0
    movaps    xmmword ptr [rsp + 64], xmm0
    movaps    xmmword ptr [rsp + 48], xmm0
    movaps    xmmword ptr [rsp + 32], xmm0
    movaps    xmmword ptr [rsp + 16], xmm0
    movaps    xmmword ptr [rsp], xmm0
    movaps    xmmword ptr [rsp - 16], xmm0
    movaps    xmmword ptr [rsp - 32], xmm0
    movaps    xmmword ptr [rsp - 48], xmm0
    movaps    xmmword ptr [rsp - 64], xmm0
    movaps    xmmword ptr [rsp - 80], xmm0
    movaps    xmmword ptr [rsp - 96], xmm0
    movaps    xmmword ptr [rsp - 112], xmm0
    movaps    xmmword ptr [rsp - 128], xmm0
    movzx    ebx, byte ptr [rdi]
    mov    r8d, 1
    movabs    r9, 7205935360012976128
    xor    ecx, ecx
    xor    edx, edx
    mov    r11d, ebx
    mov    r10d, ebx
    movzx    ebx, bl
    cmp    byte ptr [rsp + rbx - 128], 1
    je    .LBB7_4
.LBB7_7:
    mov    byte ptr [rsp + rbx - 128], 1
    inc    eax
.LBB7_4:
    cmp    bl, 62
    ja    .LBB7_5
    bt    r9, rbx
    jae    .LBB7_5
.LBB7_9:
    inc    ecx
.LBB7_10:
    xor    ebp, ebp
    cmp    bl, r11b
    setne    bpl
    add    edx, ebp
    cmp    rsi, r8
    je    .LBB7_11
    movzx    ebx, byte ptr [rdi + r8]
    inc    r8
    mov    r11d, r10d
    mov    r10d, ebx
    movzx    ebx, bl
    cmp    byte ptr [rsp + rbx - 128], 1
    jne    .LBB7_7
    jmp    .LBB7_4
.LBB7_5:
    cmp    ebx, 123
    je    .LBB7_9
    cmp    ebx, 125
    je    .LBB7_9
    jmp    .LBB7_10
.LBB7_11:
    cmp    eax, 96
    mov    edi, 96
    cmovb    edi, eax
    shl    edi, 14
    imul    rdi, rdi, 44739243
    shr    rdi, 32
    cmp    esi, 2
    mov    r8d, 1
    cmovae    r8d, esi
    imul    eax, edx, 10000
    xor    edx, edx
    div    r8d
    cmp    eax, 10000
    mov    esi, 10000
    cmovb    esi, eax
    imul    eax, ecx, 76596
    xor    edx, edx
    div    r8d
    mov    ecx, eax
    cmp    eax, 6383
    mov    eax, 6383
    cmovb    eax, ecx
    add    eax, edi
    add    eax, esi
    add    rsp, 136
    pop    rbx
    pop    rbp
.LBB7_12:
    ret

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

Global RankCapsule & DomainHardware _rdtscLatencyThroughputELF .textTernary VoteAuthor Aye
#1686score_chunk_salience_q15 (THIS CAPSULE)
domain: pqtrn-x86_64 | id: 5315850b3871282ce4e240f1eadeeb9e
8868949/200000 cyc/op4811971/400000 ns/op400000000/4811971 ops/us322 B .text (87 insns)+ (1)aye::Hue+Gemini(0+1)::x86_64 @ 432Hz