Skip to main content

Cover logo

Instant Distance: fast HNSW indexing

Build status License: MIT License: Apache 2.0

Instance Distance is a fast pure-Rust implementation of the Hierarchical Navigable Small Worlds paper by Malkov and Yashunin for finding approximate nearest neighbors. This implementation powers the Instant Domain Search backend services used for word vector indexing.

What it does

Instant Distance is an implementation of a fast approximate nearest neighbor search algorithm. The algorithm is used to find the closest point(s) to a given point in a set. As one example, it can be used to make simple translations.

Using the library

Rust

[dependencies]
instant-distance = "0.5.0"

Example

use instant_distance::{Builder, Search};

fn main() {
    let points = vec![Point(255, 0, 0), Point(0, 255, 0), Point(0, 0, 255)];
    let values = vec!["red", "green", "blue"];

    let map = Builder::default().build(points, values);
    let mut search = Search::default();

    let cambridge_blue = Point(163, 193, 173);

    let closest_point = map.search(&cambridge_blue, &mut search).next().unwrap();

    println!("{:?}", closest_point.value);
}

#[derive(Clone, Copy, Debug)]
struct Point(isize, isize, isize);

impl instant_distance::Point for Point {
    fn distance(&self, other: &Self) -> f32 {
        // Euclidean distance metric
        (((self.0 - other.0).pow(2) + (self.1 - other.1).pow(2) + (self.2 - other.2).pow(2)) as f32)
            .sqrt()
    }
}

Testing

Rust:

cargo t -p instant-distance --all-features

Python:

make test-python

Metadata

Release files for instant-distance 0.3.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for instant-distance 0.3.6
File
instant_distance-0.3.6-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl PyPy 3.10 PyPy 3.10 7.3 Linux glibc 2.17+ x86-64 Details
instant_distance-0.3.6-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl PyPy 3.9 PyPy 3.9 7.3 Linux glibc 2.17+ x86-64 Details
instant_distance-0.3.6-cp312-none-win_amd64.whl CPython 3.12 none Windows x86-64 Details
instant_distance-0.3.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
instant_distance-0.3.6-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
instant_distance-0.3.6-cp312-cp312-macosx_10_12_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.12+ x86-64 Details
instant_distance-0.3.6-cp311-none-win_amd64.whl CPython 3.11 none Windows x86-64 Details
instant_distance-0.3.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
instant_distance-0.3.6-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
instant_distance-0.3.6-cp311-cp311-macosx_10_12_x86_64.whl CPython 3.11 CPython 3.11 macOS 10.12+ x86-64 Details
instant_distance-0.3.6-cp310-none-win_amd64.whl CPython 3.10 none Windows x86-64 Details
instant_distance-0.3.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
instant_distance-0.3.6-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details
instant_distance-0.3.6-cp310-cp310-macosx_10_12_x86_64.whl CPython 3.10 CPython 3.10 macOS 10.12+ x86-64 Details
instant_distance-0.3.6-cp39-none-win_amd64.whl CPython 3.9 none Windows x86-64 Details
instant_distance-0.3.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details
instant_distance-0.3.6-cp39-cp39-macosx_11_0_arm64.whl CPython 3.9 CPython 3.9 macOS 11.0+ ARM64 Details
instant_distance-0.3.6-cp39-cp39-macosx_10_12_x86_64.whl CPython 3.9 CPython 3.9 macOS 10.12+ x86-64 Details
instant_distance-0.3.6-cp38-none-win_amd64.whl CPython 3.8 none Windows x86-64 Details
instant_distance-0.3.6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-64 Details
instant_distance-0.3.6-cp37-none-win_amd64.whl CPython 3.7 none Windows x86-64 Details
instant_distance-0.3.6-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64 Details

Total release size: 7.7 MB

Release files / instant_distance-0.3.6-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL instant_distance-0.3.6-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 418.6 kB
Tags Linux glibc 2.17+ x86-64 PyPy 3.10 PyPy 3.10 7.3
SHA-256 checksum
How to use checksums
1a038d183ea429f9a5bc4c3808a491bbb8f50d8fcbf9313f8909dce5b9e4aef7
BLAKE2b-256 checksum
How to use checksums
4aa497f2ec9c4618b12eb782a4ff23d4073d5cafbb66ef28abd171ce3e1a2f29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.0

Release files / instant_distance-0.3.6-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL instant_distance-0.3.6-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 419.8 kB
Tags Linux glibc 2.17+ x86-64 PyPy 3.9 PyPy 3.9 7.3
SHA-256 checksum
How to use checksums
8fb96cfc53caf82e06d7a9636718f2bb40f4edb22ff8b82f0feaac248414a081
BLAKE2b-256 checksum
How to use checksums
4c69329204fed1d626f7006f2a0ee6b62c8a15f4f5bec7b9aaed3fe23786d13a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.0

Release files / instant_distance-0.3.6-cp312-none-win_amd64.whl

Download URL instant_distance-0.3.6-cp312-none-win_amd64.whl
Size 248.8 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
760fd27838b09eb2a9621591bba278c8dc2502adb87bc99a8c2d013576bb925d
BLAKE2b-256 checksum
How to use checksums
ff179c1cf28eb313c025a8922b05aedd9464fcf8fe1f48f84a8bba6c1068c649
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.0

Release files / instant_distance-0.3.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL instant_distance-0.3.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 416.9 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
6196b928c6f0cb4c9a9e4cb7b7246271316c75b087a73d8c371fd6838eec5226
BLAKE2b-256 checksum
How to use checksums
bd9a33387e6edcc6155245708dd74f3af809f5d632544428f10c28e6f159c129
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.0

Release files / instant_distance-0.3.6-cp312-cp312-macosx_11_0_arm64.whl

Download URL instant_distance-0.3.6-cp312-cp312-macosx_11_0_arm64.whl
Size 359.2 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
73f855f3c69d33d86ad72527b21d436d7b144b7017050324a277991fe2638326
BLAKE2b-256 checksum
How to use checksums
6a3af68750749a17aab53d2326abcf835d272121c1834cb7eca950d54775c8c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.0

Release files / instant_distance-0.3.6-cp312-cp312-macosx_10_12_x86_64.whl

Download URL instant_distance-0.3.6-cp312-cp312-macosx_10_12_x86_64.whl
Size 365.3 kB
Tags CPython 3.12 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
177caac109c6758512068857d516357df0809919e08b6e545fdc804473586373
BLAKE2b-256 checksum
How to use checksums
9064d1d694f3fdc9942f4aa4d8b72478183d83bdc4d02731de72408de3d8cf94
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.0

Release files / instant_distance-0.3.6-cp311-none-win_amd64.whl

Download URL instant_distance-0.3.6-cp311-none-win_amd64.whl
Size 250.5 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
e15dd2458c7d7da2201a80501e84aa12f3b1adb7920f6fd9d053645a9e689f1c
BLAKE2b-256 checksum
How to use checksums
b24c574920e7ab729290715682ad4f31f0d64c657f4459350ba5f88f55484cda
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.0

Release files / instant_distance-0.3.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL instant_distance-0.3.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 417.2 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
64b3522937886a5e7c66fc57ab3867049d7d14bb3ae0aa3af07900cb4e8d6567
BLAKE2b-256 checksum
How to use checksums
cb91f3c976de65026091d2e2cc691c1bf8049385659ef6a7734327998c992405
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.0

Release files / instant_distance-0.3.6-cp311-cp311-macosx_11_0_arm64.whl

Download URL instant_distance-0.3.6-cp311-cp311-macosx_11_0_arm64.whl
Size 359.2 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0aae0938bd5b5b4c11d54d2d56091649ec24444825595f270a96753fc5408d9d
BLAKE2b-256 checksum
How to use checksums
6d5dd1cab12af1005372319db9090850c536f2b644eb6ed3acb6fc26e2948b50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.0

Release files / instant_distance-0.3.6-cp311-cp311-macosx_10_12_x86_64.whl

Download URL instant_distance-0.3.6-cp311-cp311-macosx_10_12_x86_64.whl
Size 365.7 kB
Tags CPython 3.11 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
9c517479f5361f7b49875736ab605f596a47285a03309e672f6ebf5a1d8203a9
BLAKE2b-256 checksum
How to use checksums
6f6f8a38f37a0f0480477c3665d88772fd2e104adc47c3f8ca81287c38100dbf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.0

Release files / instant_distance-0.3.6-cp310-none-win_amd64.whl

Download URL instant_distance-0.3.6-cp310-none-win_amd64.whl
Size 250.4 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
9cfc25c27dec5c3f39a579bbc31782a856ffde4c1644cbd12ee806d9f29d36fd
BLAKE2b-256 checksum
How to use checksums
d0ba0b312578bf9835e61fa5ee3b31f6113240490efd0ef8121b87e8f1452581
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.0

Release files / instant_distance-0.3.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL instant_distance-0.3.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 417.2 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
2a71e472549a45ef01bae1537c5f80da3ec1ac33f6374fd582c26925d58e14d8
BLAKE2b-256 checksum
How to use checksums
c042f150368ad32ad22a7ac683e30a17d5ff37102d70761450b61fbc2abce342
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.0

Release files / instant_distance-0.3.6-cp310-cp310-macosx_11_0_arm64.whl

Download URL instant_distance-0.3.6-cp310-cp310-macosx_11_0_arm64.whl
Size 359.2 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0df0fde56e9a8e3ae1df6af8fded2e5135c7f5ca55fad04f18716ca02a9c7e4d
BLAKE2b-256 checksum
How to use checksums
a4a3a00b278ced01e1b4a282d446659aa042821faf5b39d6fcd841bb77e52bf9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.0

Release files / instant_distance-0.3.6-cp310-cp310-macosx_10_12_x86_64.whl

Download URL instant_distance-0.3.6-cp310-cp310-macosx_10_12_x86_64.whl
Size 365.6 kB
Tags CPython 3.10 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
09b96f4d3e50ebe4ece0e2e54bedf155a132a2a3d2781fa979434cbe0764a29b
BLAKE2b-256 checksum
How to use checksums
153c810638ec2f53022a93b0fb949cd3a6d9108547c1cd2adcbe924cd588c8ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.0

Release files / instant_distance-0.3.6-cp39-none-win_amd64.whl

Download URL instant_distance-0.3.6-cp39-none-win_amd64.whl
Size 251.2 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
1df9cb8f8c2d64be2d2e90533d9523affbe2644466635641162660ae1c519fed
BLAKE2b-256 checksum
How to use checksums
f4934a1b3ad44b3e718efbac1ee4b3081f67183edb6f8b624acb521f11f6941b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.0

Release files / instant_distance-0.3.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL instant_distance-0.3.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 416.8 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
54f2bf3f738c41e3ead47f0d8a89197ac09901ce7fb1b417362a34a2afe31e35
BLAKE2b-256 checksum
How to use checksums
be6f6961cc8418436f50ebbea32733dc0db4b4f3e21f8ba7f1a761e1a01b6c0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.0

Release files / instant_distance-0.3.6-cp39-cp39-macosx_11_0_arm64.whl

Download URL instant_distance-0.3.6-cp39-cp39-macosx_11_0_arm64.whl
Size 359.2 kB
Tags CPython 3.9 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d051d6ba384c6437ed121ddceb7249e6d540c0e046f53ea9340cc201c93d3a06
BLAKE2b-256 checksum
How to use checksums
ffadc9222cfcfbe9f47c8bc78eb480b8a722f0ab7852e56610576e536e1cdc70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.0

Release files / instant_distance-0.3.6-cp39-cp39-macosx_10_12_x86_64.whl

Download URL instant_distance-0.3.6-cp39-cp39-macosx_10_12_x86_64.whl
Size 365.7 kB
Tags CPython 3.9 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
39bbc268960f1d803773eb08ddda859c8092e25399fbff7ff9dbedfb0039f8d9
BLAKE2b-256 checksum
How to use checksums
7cbcdc8a44f46cc057df164c060f952ba211fc37bcb700707f545d7a2e2cf772
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.0

Release files / instant_distance-0.3.6-cp38-none-win_amd64.whl

Download URL instant_distance-0.3.6-cp38-none-win_amd64.whl
Size 250.8 kB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
2b08a70abd2bb367525bde0729f54f9e1671ff4a531341db6340c886dd269027
BLAKE2b-256 checksum
How to use checksums
d36d263728a18fc4e384ecbdb74644e83e667df85bd3c59d4098ea44b7014be6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.0

Release files / instant_distance-0.3.6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL instant_distance-0.3.6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 416.7 kB
Tags CPython 3.8 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
a2294d31d7b3bb43fe7fc7fd0967ca2124337951af141bbb23ec9b8c8ee05dda
BLAKE2b-256 checksum
How to use checksums
780f544abb01480178965d72d0b7a749e120103f9f0af7964a5a3b1419dbb525
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.0

Release files / instant_distance-0.3.6-cp37-none-win_amd64.whl

Download URL instant_distance-0.3.6-cp37-none-win_amd64.whl
Size 250.5 kB
Tags CPython 3.7 Windows x86-64
SHA-256 checksum
How to use checksums
dc6b2bc4cf7fc7bafa6d1a2e628426887d0ea0032c4b9557f68d9dde14fc34d3
BLAKE2b-256 checksum
How to use checksums
717d46bf0ed09989be00e9f4ef776a358896cd5a59d27914ec2c4e326f265152
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.0

Release files / instant_distance-0.3.6-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL instant_distance-0.3.6-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 417.2 kB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
80eba42b2bbe63ebbe4155ca9d236d2b4400a24a7b6df5c8bc41990438b82f75
BLAKE2b-256 checksum
How to use checksums
d934545b1c685e1eff829c8e8bdc6e334bb883410f59490900be9d8fbd612e5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.0

Release history Release notifications | RSS feed

This release

0.3.6 This release

22 release files

0.3.0

1 release file

0.2.0

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page