From 8bcd0a4c4a8e3d748bea53d036985609ea634b8d Mon Sep 17 00:00:00 2001 From: Florin-Cristian Gavrila Date: Tue, 13 Jan 2015 18:40:05 +0000 Subject: [PATCH] http: fix performance regression for GET requests 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: https://github.com/joyent/node/pull/9026 Reviewed-By: Julien Gilli --- lib/http.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/http.js b/lib/http.js index 6f640d1af37b4e..f4e8db7de449dd 100644 --- a/lib/http.js +++ b/lib/http.js @@ -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();