Merge 'Vector speedup' from Nikita Sivukhin

This PR reduces allocation for vector distance calculation and also use
[simsimd](https://github.com/ashvardanian/SimSIMD) library to execute
cosine/l2 distances for dense vectors.

Reviewed-by: Pere Diaz Bou <pere-altea@homail.com>

Closes #3802
This commit is contained in:
Pekka Enberg
2025-10-22 12:28:43 +03:00
committed by GitHub
13 changed files with 361 additions and 149 deletions

21
Cargo.lock generated
View File

@@ -523,10 +523,11 @@ dependencies = [
[[package]]
name = "cc"
version = "1.2.17"
version = "1.2.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fcb57c740ae1daf453ae85f16e37396f672b039e00d9d866e07ddb24e328e3a"
checksum = "ac9fe6cdbb24b6ade63616c0a0688e45bb56732262c158df3c0c4bea4ca47cb7"
dependencies = [
"find-msvc-tools",
"jobserver",
"libc",
"shlex",
@@ -1504,6 +1505,12 @@ dependencies = [
"windows-sys 0.59.0",
]
[[package]]
name = "find-msvc-tools"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52051878f80a721bb68ebfbc930e07b65ba72f2da88968ea5c06fd6ca3d3a127"
[[package]]
name = "findshlibs"
version = "0.10.2"
@@ -4143,6 +4150,15 @@ dependencies = [
"similar",
]
[[package]]
name = "simsimd"
version = "6.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e3f209c5a8155b8458b1a0d3a6fc9fa09d201e6086fdaae18e9e283b9274f8f"
dependencies = [
"cc",
]
[[package]]
name = "slab"
version = "0.4.9"
@@ -4924,6 +4940,7 @@ dependencies = [
"rustix 1.0.7",
"ryu",
"serde",
"simsimd",
"sorted-vec",
"strum",
"strum_macros",