Skip to content

Faster Double-Precision Math

Compare
Choose a tag to compare
@ashvardanian ashvardanian released this 26 Nov 12:12
· 0 commits to e81f594b81801a3ef8d25a9682a5247ef297485d since this release

As was discussed in the SciPy integration thread, Python libraries use double-precision floating-point numbers by default.
So, in this release, I've extended the spatial distance functions in the underlying SimSIMD - Cos, L2sq, IP with support for double arguments with specialized implementations on AVX-512-capable x86 CPUs and SVE-capable Arm CPUs.

Benchmarking SimSIMD vs. SciPy on Intel Sapphire Rapids CPU

  • Vector dimensions: 1536
  • Vectors count: 1000
  • Hardware capabilities: serial, x86_avx2, x86_avx512, x86_avx2fp16, x86_avx512fp16, x86_avx512vpopcntdq, x86_avx512vnni
  • NumPy BLAS dependency: openblas64
  • NumPy LAPACK dependency: dep140640983012528

Between 2 Vectors, Batch Size: 1

Datatype Method Ops/s SimSIMD Ops/s SimSIMD Improvement
f64 scipy.cosine 63,612 572,605 9.00 x
f64 scipy.sqeuclidean 238,547 915,596 3.84 x
f64 numpy.inner 449,499 986,522 2.19 x

Between 2 Vectors, Batch Size: 1,000

Datatype Method Ops/s SimSIMD Ops/s SimSIMD Improvement
f64 scipy.cosine 68,962 1,457,172 21.13 x
f64 scipy.sqeuclidean 247,727 1,535,547 6.20 x
f64 numpy.inner 463,509 1,512,004 3.26 x

Benchmarking SimSIMD vs. SciPy on AWS Graviton 3

  • Vector dimensions: 1536
  • Vectors count: 1000
  • Hardware capabilities: serial, arm_neon, arm_sve
  • NumPy BLAS dependency: openblas64
  • NumPy LAPACK dependency: openblas64

Between 2 Vectors, Batch Size: 1

Datatype Method Ops/s SimSIMD Ops/s SimSIMD Improvement
f64 scipy.cosine 40,729 725,382 17.81 x
f64 scipy.sqeuclidean 160,812 728,114 4.53 x
f64 numpy.inner 473,443 767,374 1.62 x
f64 scipy.jensenshannon 15,684 38,528 2.46 x
f64 scipy.kl_div 49,983 61,811 1.24 x

Between 2 Vectors, Batch Size: 1,000

Datatype Method Ops/s SimSIMD Ops/s SimSIMD Improvement
f64 scipy.cosine 41,130 1,460,850 35.52 x
f64 scipy.sqeuclidean 162,147 1,486,255 9.17 x
f64 numpy.inner 473,856 1,580,136 3.33 x

Hashes

  • docs.tar.gz : def474428a4d67076e68dfd16b660a53bf51fad12af7e4c6ee77e1555b220b8f
  • usearch-v2.8.14.tar.gz : 6ae186618120b6c710ff3ed1bf31e9a58610e7b837bccdeae79000247c2b24a3
  • usearch-v2.8.14.zip : a1da6b34bc23111926b16be9d36a7403988405a00c833417b27b8ccd9c70227f
  • usearch_linux_amd_2.8.14.deb : ae4995f9504a9ab90921e3091a5aa6af432de647f1a6c835ee5cb2622dd2f8a3
  • usearch_linux_arm_2.8.14.deb : dafcee294630b7c17adaed9aebb668d4cbfc5fe269f35f66b10bf458d66d899d
  • usearch_macOS_arm64_2.8.14.zip : 65e0a8d0259400e35de692c9afb3406d6bd4db5dd2f46632676890c41ba1537c
  • usearch_macOS_x86_64_2.8.14.zip : 1fa9a6e6983f5b6fe5dd2b82ce566262dcbd1d1e8671ec39b9d01ceddc3b80dd
  • usearch_wasm_linux_arm64_2.8.14.tar.gz : edb5846ab0b38b1095b12f2b8ca771748394911bf6efd74df6d5ba66f36328d9
  • usearch_wasm_linux_x86_64_2.8.14.tar.gz : 84e4162db1dc83157f7a4032278c9cfc01a68ac59c4b1af1b5fc35e43905c515
  • usearch_wasm_macos_arm64_2.8.14.zip : 8c966ef2f5e425cf82f472bd4b74f0e7cd7fa39b860dd9f25f488370afc035fe
  • usearch_wasm_macos_x86_64_2.8.14.zip : 7e48cc5d0e34b586f36b86671c8410b2b2deca31962beb0ccf6230546ac42621
  • usearch_wasm_windows_x64_2.8.14.tar.gz : 02b1382c68fe8ef52d55da639a38ad15c7449d579230ef5ae78465776fd689fa
  • usearch_wasm_windows_x86_2.8.14.tar.gz : cf922953ca61c8f9101fac33a2aa06d70fd09ef8b8c73d64a6623f73dcfe09cc
  • usearch_windows_x64_2.8.14.tar : 8a74a122fafae229f65df8de5a6e264eb16a7e5eba691629d6439b0b54ea8b74
  • usearch_windows_x86_2.8.14.tar : 96c6625fc2ca723cc44e864a75f5c72dc3ab9aeb5fe5f0f80ba32783121f6766