ashvardanian / SimSIMD

Up to 200x Faster Dot Products & Similarity Metrics — for Python, Rust, C, JS, and Swift, supporting f64, f32, f16 real & complex, i8, and bit vectors using SIMD for both AVX2, AVX-512, NEON, SVE, & SVE2 📐
https://ashvardanian.com/posts/simsimd-faster-scipy/
Apache License 2.0
989 stars 59 forks source link

Cannot import in go project #111

Closed EricZequan closed 7 months ago

EricZequan commented 7 months ago

Afterimported "github.com/ashvardanian/simsimd" in my golang project, i try to call simsimd.CosineI8, but it doesn't recognize.

i have used go get github.com/ashvardanian/simsimd@latest to import this package.

and here is my simple test:

package main

import "github.com/ashvardanian/simsimd"

func main() {
    a := []int8{1, 2, 3}
    b := []int8{4, 5, 6}
    result := simsimd.CosineI8(a, b)
    println(result)
}

I'm wondering if there's something wrong with my approach, how do I call this?

ashvardanian commented 7 months ago

Hi @EricZequan! Thanks for considering SimSIMD. Sadly, the SimSIMD GoLang binding would work slower than native GoLang code due to the insane cost of Foreign Function Interfaces in GoLang. You may be interested in considering USearch for some vector-search problems, if dealing with large datasets.

In both cases with USearch and SimSIMD, you should still download the pre-compiled native library from the release notes, and link it against your executable 🤗