Skip to content

perf(vector/index): use Vec<u32> doc-id internal type throughout the index (instead of u64) #635

Description

@mosuka

Round-3 perf push sub-issue (tracked under umbrella #535).

[S] Use Vec<u32> doc-id internal type throughout the index (instead of u64)

  • Where: HNSW graph (graph.rs:21-22,73), Concurrent build
    (writer.rs:40), QuantizedVectorPool::field_index value type
    (quantized_storage.rs:45), neighbour lists, etc.
  • Current behaviour: doc IDs are u64 end-to-end inside the
    index, even though they're segment-local ordinals once we get past
    the public API.
  • Why it might be a bottleneck: every neighbour list, visited
    set, candidate heap stores 8 B per entry — half what is needed
    for <=2^31 segment sizes (segment size is anyway capped by the
    vector_count u32 in IVF/Flat headers).
  • Reference precedent: Lucene uses int ordinals; Qdrant uses
    u32 PointOffset internally.
  • Suggested direction: introduce InternalId = u32 with From/
    TryFrom<u64> conversion at the boundary; refactor graph storage
  • Risk / scope: small but pervasive type churn; pairs naturally
    with the CSR migration (Add parallel search #1).


ID: VI-17 — see ~/.claude/tasks/laurus/20260523_perf_round3_audit/task_list.md for the full Round-3 issue list.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions