Skip to content

Commit 1e1e709

Browse files
committed
perf: buffer accumulation in _write_query_params()
Replace the per-parameter write_value(f, param) loop in _QueryMessage._write_query_params() with a buffer accumulation approach: list.append + b"".join + single f.write(). This reduces the number of f.write() calls from 2*N+1 to 1, which is significant for vector workloads with large parameters. Also removes the redundant ExecuteMessage._write_query_params() pass-through override to avoid extra MRO lookup per call. Includes 14 unit tests covering normal, NULL, UNSET, empty, large vector, and mixed parameter scenarios for both ExecuteMessage and QueryMessage. Includes a benchmark script (benchmarks/bench_execute_write_params.py).
1 parent caa98b6 commit 1e1e709

3 files changed

Lines changed: 739 additions & 6 deletions

File tree

0 commit comments

Comments
 (0)