Skip to content

Benchmarks

Large-candidate benchmark

Dataset: 5,000,000 hashes.

BenchmarkLimitTime
Large candidate search20548.238ms
Large candidate search1000540.776ms
Large candidate search, no limit effectunlimited4.570s

What this means

Looking for the best matches?
Finding the top 20 or top 1000 similar images takes around half a second, even with five million hashes indexed.

Why is unlimited slower?
When no limit is applied, the extension must continue processing and sorting every possible match. Most real-world applications only need the closest matches.

Plain English: searching five million hashes does not automatically mean comparing against every single hash one by one in PHP.

Index performance

Benchmarked with 500 precomputed dHashes.

OperationTimeApprox throughput
Add 500 hashes0.27 ms~1.85M ops/sec
Search 500 hashes0.50 ms~1M ops/sec
Add + Search0.51 ms~980K ops/sec
Save + Load Index12 ms~83 ops/sec

What this means

Building an index is extremely fast.
Adding hashes is effectively instantaneous for normal workloads. Millions of hashes can be imported in minutes rather than hours.

Searches are designed for interactive use.
The extension is fast enough to power web applications, APIs and security tooling without requiring a separate search service.

Persistence is cheap.
Indexes can be saved and restored quickly, making it practical to pre-build indexes and load them at application startup.

Hash generation benchmark

TooldHashdHash throughputpHashpHash throughput
php_imagehash2.316s~216 hashes/sec2.425s~206 hashes/sec
Python ImageHash4.168s~120 hashes/sec5.184s~96 hashes/sec
jenssegers/imagehash7.168s~70 hashes/sec12.177s~41 hashes/sec

What this means

Faster image processing.
php_imagehash generates hashes roughly 2× faster than Python ImageHash and up to 5× faster than the popular pure-PHP implementation.

Less waiting during imports.
When processing large image collections, hash generation is often the bottleneck. Faster hashing means datasets can be indexed significantly sooner.

Native performance.
The extension performs the heavy lifting in Rust rather than PHP userland, reducing overhead while keeping a simple PHP API.

Native tools, weird experiments, and practical performance work.