mirror of
https://github.com/Gouryella/drip.git
synced 2026-02-24 05:10:43 +00:00
refactor(buffer): Optimizes TCP and HTTP streaming request processing using a buffer pool.
Replaces the fixed-size buffers in `FrameHandler` and `Handler` with dynamic buffers obtained from the buffer pool, to reduce memory allocation and improve performance. Also updates the logo path in the README to match the new resource directory structure.
This commit is contained in:
@@ -312,7 +312,9 @@ func (h *Handler) streamLargeRequest(w http.ResponseWriter, r *http.Request, tra
|
||||
}
|
||||
}
|
||||
|
||||
buffer := make([]byte, 32*1024)
|
||||
streamBufPtr := h.bufferPool.GetMedium()
|
||||
defer h.bufferPool.PutMedium(streamBufPtr)
|
||||
buffer := (*streamBufPtr)[:pool.MediumBufferSize]
|
||||
for {
|
||||
n, readErr := r.Body.Read(buffer)
|
||||
if n > 0 {
|
||||
|
||||
Reference in New Issue
Block a user