Skip to content

go-vector v1.2.1

Latest

Choose a tag to compare

@jkyberneees jkyberneees released this 30 May 15:26
ee66d5a

go-vector v1.2.1

Search performance — backward compatible, zero dependencies.

Performance

  • Store.Search: replaced the full reflection-based sort.Slice over all
    n candidates with a bounded top-k max-heap — O(n·log k) selection instead
    of O(n·log n), and O(k) scratch memory instead of O(n).
  • Cosine search: the query's self dot-product is now computed once per
    search rather than re-derived for every stored vector.
  • Manhattan: branchless float32 abs, dropping the per-element float64
    round-trip (still zero-allocation).
  • RandomProjections: preallocate sparse projection rows and tokenizer
    output to cut append churn during Fit/Embed.

Measured (k=10): StoreSearch10000 25.6ms → 22.0ms with scratch memory down
185KB → 62KB; SearchCosine 1.10ms → 0.99ms. Distance results are identical.