timescale / pgvectorscale

A complement to pgvector for high performance, cost efficient vector search on large workloads.
PostgreSQL License
1.37k stars 58 forks source link

Optimized XOR is 14% slower than unoptimized XOR on Apple Silicon #176

Open tjgreen42 opened 21 hours ago

tjgreen42 commented 21 hours ago

What happened?

On my Macbook Pro cargo bench shows optimized XOR running about 14% slower than unoptimized XOR:

Distance xor/xor unoptimized u64
                        time:   [3.7793 ns 3.7834 ns 3.7899 ns]

Distance xor/xor optimized version we use in code
                        time:   [4.3114 ns 4.3156 ns 4.3244 ns]

The same experiment on an x86 cloud desktop shows a speedup of around 3x:

Distance xor/xor unoptimized u64
                        time:   [25.285 ns 25.497 ns 25.713 ns]
Distance xor/xor optimized version we use in code
                        time:   [8.8554 ns 8.9635 ns 9.0748 ns

pgvectorscale extension affected

0.5.1

PostgreSQL version used

17

What operating system did you use?

MacOS 15.1.1 / Debian 12

What installation method did you use?

Source

What platform did you run on?

Amazon Web Services (AWS)

Relevant log output and stack trace

No response

How can we reproduce the bug?

cargo bench

Are you going to work on the bugfix?

None