ashvardanian / SimSIMD

Up to 200x Faster Inner Products and Vector Similarity — for Python, JavaScript, Rust, C, and Swift, supporting f64, f32, f16 real & complex, i8, and binary vectors using SIMD for both x86 AVX2 & AVX-512 and Arm NEON & SVE 📐
https://ashvardanian.com/posts/simsimd-faster-scipy/
Apache License 2.0
794 stars 42 forks source link

Cannot import in go project #111

Closed EricZequan closed 2 months ago

EricZequan commented 2 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 2 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 🤗