Skip to content

Commit 9b21d5b

Browse files
committed
perf: buffer accumulation in _write_query_params() reduces f.write() calls
Replace the per-parameter write_value(f, param) loop in _QueryMessage._write_query_params() with list.append + b"".join + single f.write(). This reduces the number of write() syscall-like calls from (2*N + 1) to 1 for N query parameters. Benchmarks (500K iterations, best-of-5, Python 3.14, Cython .so): 128D float32 vector (1 param): 1.25x faster 768D float32 vector (1 param): 1.12x faster 1536D float32 vector (1 param): 1.11x faster 10 text columns: 1.30x faster Also removes the unnecessary super() pass-through in ExecuteMessage._write_query_params() to eliminate MRO lookup overhead. Includes benchmark script and 14 new unit tests covering normal, NULL, UNSET, mixed, empty, large vector, and many-parameter scenarios.
1 parent 8e6c4d4 commit 9b21d5b

3 files changed

Lines changed: 739 additions & 6 deletions

File tree

0 commit comments

Comments
 (0)