Skip to content

Commit

Permalink
http: fix performance regression for GET requests
Browse files Browse the repository at this point in the history
A significant performance regressions has been introduced in 1fddc1f for
GET requests which send data through response.end(). The number of
requests per second dropped to somewhere around 6% of their previous
level.

The fix consists of removing a part of the lines added by 1fddc1f,
lines which were supposed to affect only HEAD requests, but interfered
with GET requests instead.

The lines removed would not have affected the behaviour in the case of
a HEAD request as this._hasBody would always be false. Therefore, they
were not required to fix the issue reported in #8361.

Fixes #8940.

PR: #9026
PR-URL: nodejs/node-v0.x-archive#9026
Reviewed-By: Julien Gilli <julien.gilli@joyent.com>
  • Loading branch information
CGavrila authored and Julien Gilli committed Mar 5, 2015
1 parent d01a900 commit 8bcd0a4
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions lib/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -946,10 +946,6 @@ OutgoingMessage.prototype.end = function(data, encoding) {
if (encoding === 'hex' || encoding === 'base64')
hot = false;

// Transfer-encoding: chunked responses to HEAD requests
if (this._hasBody && this.chunkedEncoding)
hot = false;

if (hot) {
// Hot path. They're doing
// res.writeHead();
Expand Down

0 comments on commit 8bcd0a4

Please sign in to comment.