Skip to content

Investigate remaining SIMD performance opportunities #51

Description

@mrecachinas

Context

The ARM64 optimization passes have exhausted the credible local opportunities: scalar and NEON kernels are close to their instruction floors, per-record dispatch is hoisted, the winning 16-byte specialization landed, Rayon/GIL crossovers are measured, and Python buffer overhead is minimized. Fixed-width 32-byte specialization was neutral, while 64/128-byte specializations regressed and were reverted.

Only two material performance avenues remain:

Opportunities

  1. x86-specific SIMD, measured on real hardware

    • Benchmark AVX2 and AVX-512 implementations on representative x86 CPUs.
    • Evaluate VPSHUFB lookup/popcount strategies for AVX2 and VPOPCNTB/VPOPCNTDQ-capable AVX-512 paths.
    • Test batched threshold (_with_max) reductions and retune dispatch cutovers.
    • Keep separate results for AVX2-only and AVX-512-capable machines; do not infer wins from generated assembly alone.
  2. Cross-record SIMD for array scans

    • Process multiple fixed-width records per vector rather than invoking one kernel per record.
    • Prioritize 16- and 32-byte records for first, best, and all; expand only when measurements justify it.
    • Preserve first-index ordering, best-distance tie behavior, threshold short-circuiting, and exact-match termination.
    • Measure random no-match, early/mid/late match, and parallel-crossover workloads.

Acceptance criteria

  • Before/after results from at least three benchmark runs on the same machine.
  • End-to-end Python array benchmarks as well as raw Rust Criterion results.
  • No public API or semantic changes.
  • Revert experiments that do not outperform the current kernels outside benchmark noise.

Everything else identified during the performance review was either landed or measured and rejected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestrustPull requests that update rust code

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions