Skip to content

perf(memory): implement thread-local buffer pool for request bodies (#160) - #177

Merged
ZhuchkaTriplesix merged 1 commit into
devfrom
perf-buffer-pool-160
Aug 27, 2026
Merged

perf(memory): implement thread-local buffer pool for request bodies (#160)#177
ZhuchkaTriplesix merged 1 commit into
devfrom
perf-buffer-pool-160

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

Closes #160

  • Added src/buffer_pool.rs providing PooledBuffer with automatic RAII recycling to a thread-local buffer pool on Drop (for buffers with capacity between 16 KB and 128 KB).
  • Updated run_rsgi in src/dispatch.rs to read incoming request bodies into PooledBuffer using zero-copy PyBytes::as_bytes / PyString::to_str slice extensions instead of allocating a fresh Vec<u8> on every request.
  • Eliminated heap allocation and deallocation churn for request payloads on high-throughput workloads.

@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit ac7452a into dev Aug 27, 2026
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant