Skip to content

Commit 58eb339

Browse files
mrecachinasCopilot
andauthored
docs: refresh README benchmarks post SIMD speedups (#43)
Re-run criterion and pytest-benchmark on current master and update both tables. Drop the 16384x64 rows from the raw Rust table since those workloads cross the Rayon threshold and criterion's measurement interacts poorly with the thread pool; point readers to the Python table for representative large-array numbers. Expand the Python table to cover start/mid/end match positions and additional sizes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent c802ae9 commit 58eb339

1 file changed

Lines changed: 45 additions & 34 deletions

File tree

README.rst

Lines changed: 45 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -194,48 +194,59 @@ These numbers show the pure computation time using Rust's ``criterion`` benchmar
194194
Name Mean (ns)
195195
=========================================== ===========
196196
hex_string (NEON) [16 chars] 2.0
197-
hex_string (NEON) [64 chars] 5.7
198-
hex_string (NEON) [128 chars] 11.0
199-
hex_string (NEON) [254 chars] 20.9
200-
bytes (NEON) [8 bytes] 1.1
201-
bytes (NEON) [32 bytes] 1.3
202-
bytes (NEON) [64 bytes] 2.0
203-
bytes (NEON) [127 bytes] 5.2
197+
hex_string (NEON) [64 chars] 5.8
198+
hex_string (NEON) [128 chars] 11.2
199+
hex_string (NEON) [254 chars] 21.2
200+
bytes (NEON) [8 bytes] 1.8
201+
bytes (NEON) [32 bytes] 2.8
202+
bytes (NEON) [64 bytes] 2.6
203+
bytes (NEON) [127 bytes] 6.6
204204
bytes_within_dist [127 bytes] 1.6
205-
array first [512×16, at start] 2.5
206-
array first [512×16, at end] 525.0
207-
array best [512×16] 1,419.0
208-
array all [512×16] 535.0
209-
array first [16384×64, at mid] 8,430.0
210-
array best [16384×64] 42,981.0
211-
array all [16384×64] 16,400.0
205+
array first [512×16, at start] 2.3
206+
array first [512×16, at end] 671.4
207+
array best [512×16] 925.8
208+
array all [512×16] 799.4
212209
=========================================== ===========
213210

211+
Larger array workloads cross the parallel (Rayon) threshold; see the Python
212+
table below for representative end-to-end numbers.
213+
214214
Python API (via PyO3)
215215
~~~~~~~~~~~~~~~~~~~~~
216216

217217
These numbers include Python function call overhead (~45 ns) using ``pytest-benchmark``.
218218

219-
====================================================== =========== ==========
220-
Name Mean (ns) Std (ns)
221-
====================================================== =========== ==========
222-
hamming_distance_string [3 chars, same] 48.8 10.1
223-
hamming_distance_string [3 chars, diff] 48.4 4.4
224-
hamming_distance_string [64 chars, diff] 88.2 16.0
225-
hamming_distance_string [1024 chars, diff] 785.0 137.1
226-
hamming_distance_bytes [3 bytes, same] 48.5 5.5
227-
hamming_distance_bytes [64 bytes, diff] 50.3 8.4
228-
hamming_distance_bytes [1024 bytes, diff] 69.1 16.0
229-
check_bytes_within_dist [127 bytes] 53.4 5.3
230-
first_within_dist [512×16, at start] 70.0 6.3
231-
first_within_dist [512×16, at end] 721.2 65.7
232-
first_within_dist [16384×64, at end] 48,927.1 8,321.5
233-
best_within_dist [512×16] 759.2 108.4
234-
best_within_dist [16384×64] 46,295.0 3,793.5
235-
all_within_dist [512×16] 776.3 70.9
236-
all_within_dist [16384×64] 46,602.1 2,944.3
237-
====================================================== =========== ==========
219+
====================================================== ===========
220+
Name Mean (ns)
221+
====================================================== ===========
222+
hamming_distance_string [3 chars, same] 84.6
223+
hamming_distance_string [3 chars, diff] 83.6
224+
hamming_distance_string [64 chars, diff] 91.3
225+
hamming_distance_string [1024 chars, diff] 207.4
226+
hamming_distance_bytes [3 bytes, same] 127.3
227+
hamming_distance_bytes [3 bytes, diff] 96.2
228+
hamming_distance_bytes [64 bytes, diff] 169.9
229+
hamming_distance_bytes [1024 bytes, diff] 175.2
230+
check_hexstrings_within_dist [1000 chars] 221.3
231+
check_bytes_within_dist [16 bytes] 146.2
232+
check_bytes_within_dist [64 bytes] 107.7
233+
check_bytes_within_dist [127 bytes] 100.6
234+
first_within_dist [512×16, at start] 98.7
235+
first_within_dist [512×16, mid] 570.8
236+
first_within_dist [512×16, at end] 1,030.1
237+
first_within_dist [16384×64, at start] 99.6
238+
first_within_dist [16384×64, mid] 20,838.8
239+
first_within_dist [16384×64, at end] 41,489.5
240+
best_within_dist [512×16, at start] 1,609.8
241+
best_within_dist [512×16, at end] 1,116.4
242+
best_within_dist [16384×64, mid] 46,826.1
243+
all_within_dist [512×16, at start] 1,342.9
244+
all_within_dist [512×16, at end] 1,365.9
245+
all_within_dist [16384×64, mid] 48,067.2
246+
====================================================== ===========
238247

239248
For small inputs, Python call overhead dominates (~45 ns). For large inputs
240249
(1024+ chars, 16384-element arrays), computation dominates and Python overhead
241-
is negligible.
250+
is negligible. Array APIs transparently parallelize with Rayon once the input
251+
exceeds ~64 KiB; the ``first`` variant additionally short-circuits on the first
252+
hit, so a match near the start is much faster than one near the end.

0 commit comments

Comments
 (0)