From: rbalamohan (@rbalamohan) <noreply+rbalamohan@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: [pgvector/pgvector] issue #832: Perf: SIMD optimization for cosine similarity in pgvector
Date: Fri, 02 May 2025 07:47:31 +0000
Message-ID: <gh-pgvector-pgvector-832@github.com> (raw)
There are various cases where comparisons like
`vector <=> '[0.01180855743587017,....-0.014453507959842682]` (1536 embeddings) are compared. This involves cosine similarity. i.e in vector.c
Current implementation is based on scalar loop. Request is to provide options to make use of SIMD instructions on supported platforms. Almost all of modern h/w should support it, some docker images may not have the support.
But basic request is to explore using SIMD instructions to speeden up things for this, when dimension are greater than 8.