Comments (5)
Do you have the code somewhere ? It's definitely slower but not 100 times for sure
from hnswlib.
I have attached the code as zip file. I am testing against the glove-100-angular dataset that can be downloaded from ann-benchmarks.com. It has 1M vectors. d = 100. and 10k test vectors.
The Java code (this library) takes 2 mins to build the index (i.e., adding 1M vectors to the index) and 4.6s to query the index (10k test vectors).
The C++ code (original hnswlib) takes 35.94 seconds to build the index and 0.048 seconds to query the index (i.e., 100x faster).
Both tests run on same Linux machine with 14 threads (1 thread per vCPU). the multi-threading only applies when building the index. Querying is single-threaded in both cases.
from hnswlib.
one question (unrelated to the topic in this thread btw) is that w.r.t. this:
Object lock = locks.computeIfAbsent(item.id(), k -> new Object());
Can't you just use
synchronized (node)
like you do on line 268
Another question I have is that I tried the code with SIMD optimizations on a AVX512 CPU but the perf is basically the same. Do you know why? I was expecting 16x improvement in perf (16*32=512) as one instruction would process 16 floats.
from hnswlib.
re: this: Another question I have is that I tried the code with SIMD optimizations on a AVX512 CPU but the perf is basically the same. Do you know why? I was expecting 16x improvement in perf (16*32=512) as one instruction would process 16 floats.
could it be that Java compiler is auto-vectorizing the code without explicit SIMD optimizations? e.g., see this:
However, Oracle has apparently just accepted Intel's contribution to the HotSpot that enables FMA vectorization using AVX-512. To the delight of auto-vectorization fans and those lucky ones to have access to AVX-512 hardware, this may (with some luck) appear in one of the next jdk9 EA builds (beyond b175).
A link to support the previous statement (RFR(M): 8181616: FMA Vectorization on x86): mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2017-June/…
do you know if is there any way to verify?
from hnswlib.
Hello All,
Is this issue fixed or something. Just want to check the most recent status on the java implementation. And also, I think bray-curtis distance is not a metric while hnsw requires that distance should be a metric.
Thanks,
Jianshu
from hnswlib.
Related Issues (20)
- Not able to load persisted index HOT 6
- excludeSelf parameter in hnswlib class not working HOT 5
- Repeatability HOT 1
- Why is there no float-64 support in hnswlib-core-jdk17 HOT 1
- Small number of queries succeeds, whereas larger number fails HOT 4
- benchmark / performance HOT 1
- PySpark OOM advice HOT 12
- Unable to update index HOT 4
- Unable to load the HnswSimilarity model HOT 1
- scala 2.12 port running very slowly HOT 7
- Error: Cannot up cast `partition` from bigint to int. HOT 1
- Brute Force vs hnsw Problem HOT 3
- Big K - output empty result HOT 3
- Load does not work HOT 1
- not all index partitions are persisted (data loss) on k8s HOT 28
- cannot calculate resize correctly leading to SizeLimitExceededException HOT 2
- support for num_threads parameter while building the index HOT 1
- Question about maxLevel
- If there is no near similar items. What is the output? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hnswlib.