pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
From: ivanstepanovftw (@ivanstepanovftw) <noreply+ivanstepanovftw@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: [pgvector/pgvector] PR #710: Optimization: added `restrict`
Date: Sat, 09 Nov 2024 17:31:10 +0000
Message-ID: <gh-pgvector-pgvector-710@github.com> (raw)

solves #709

inline patch 1: src/vector.c (+3/-3 lines) download inline-1.patchdiff --git a/src/vector.c b/src/vector.c index a5b2aac36..927c56a28 100644 --- a/src/vector.c +++ b/src/vector.c @@ -590,7 +590,7 @@ vector_l2_squared_distance(PG_FUNCTION_ARGS) } VECTOR_TARGET_CLONES static float -VectorInnerProduct(int dim, float *ax, float *bx) +VectorInnerProduct(int dim, float *const restrict ax, float *const restrict bx) { float distance = 0.0; @@ -632,7 +632,7 @@ vector_negative_inner_product(PG_FUNCTION_ARGS) } VECTOR_TARGET_CLONES static double -VectorCosineSimilarity(int dim, float *ax, float *bx) +VectorCosineSimilarity(int dim, float *const restrict ax, float *const restrict bx) { float similarity = 0.0; float norma = 0.0; @@ -708,7 +708,7 @@ vector_spherical_distance(PG_FUNCTION_ARGS) /* Does not require FMA, but keep logic simple */ VECTOR_TARGET_CLONES static float -VectorL1Distance(int dim, float *ax, float *bx) +VectorL1Distance(int dim, float *const restrict ax, float *const restrict bx) { float distance = 0.0;

view thread (4+ messages)  latest in thread

Message-ID: <gh-pgvector-pgvector-710@github.com>
Permalink:  ../gh-pgvector-pgvector-710@github.com/

 ·  · 


This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox