forked from nodejs/node-v0.x-archive
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
http: improve chunked res.write(buf) performance
Avoid a costly buffer-to-string operation. Instead, allocate a new buffer, copy the chunk header and data into it and send that. The speed difference is negligible on small payloads but it really shines with larger (10+ kB) chunks. benchmark/http/end-vs-write-end with 64 kB chunks gives 45-50% higher throughput. With 1 MB chunks, the difference is a staggering 590%. Of course, YMMV will vary with real workloads and networks but this commit should have a positive impact on CPU and memory consumption. Big kudos to Wyatt Preul (@wpreul) for reporting the issue and providing the initial patch. Fixes nodejs#5941 and nodejs#5944.
- Loading branch information
1 parent
6359e01
commit 3398cce
Showing
1 changed file
with
93 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters