summaryrefslogtreecommitdiff
path: root/lib/_http_outgoing.js
diff options
context:
space:
mode:
authorTimothy Gu <timothygu99@gmail.com>2017-03-19 16:11:10 -0700
committerTimothy Gu <timothygu99@gmail.com>2017-03-24 15:25:49 -0700
commitcfc8422a68c92808a4a2aee374623bebc768522a (patch)
treea5ca63de5fee40991d49a5731fe32e3072f097b0 /lib/_http_outgoing.js
parent14a91957f8bce2d614ec361f982aa56378f1c24e (diff)
downloadandroid-node-v8-cfc8422a68c92808a4a2aee374623bebc768522a.tar.gz
android-node-v8-cfc8422a68c92808a4a2aee374623bebc768522a.tar.bz2
android-node-v8-cfc8422a68c92808a4a2aee374623bebc768522a.zip
lib: use Object.create(null) directly
After V8 5.6, using Object.create(null) directly is now faster than using a constructor for map-like objects. PR-URL: https://github.com/nodejs/node/pull/11930 Refs: https://github.com/emberjs/ember.js/issues/15001 Refs: https://crrev.com/532c16eca071df3ec8eed394dcebb932ef584ee6 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/_http_outgoing.js')
-rw-r--r--lib/_http_outgoing.js5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js
index cdca2d4e89..a8e04d543a 100644
--- a/lib/_http_outgoing.js
+++ b/lib/_http_outgoing.js
@@ -31,7 +31,6 @@ const common = require('_http_common');
const checkIsHttpToken = common._checkIsHttpToken;
const checkInvalidHeaderChar = common._checkInvalidHeaderChar;
const outHeadersKey = require('internal/http').outHeadersKey;
-const StorageObject = require('internal/querystring').StorageObject;
const CRLF = common.CRLF;
const debug = common.debug;
@@ -143,7 +142,7 @@ Object.defineProperty(OutgoingMessage.prototype, '_headerNames', {
get: function() {
const headers = this[outHeadersKey];
if (headers) {
- const out = new StorageObject();
+ const out = Object.create(null);
const keys = Object.keys(headers);
for (var i = 0; i < keys.length; ++i) {
const key = keys[i];
@@ -552,7 +551,7 @@ OutgoingMessage.prototype.getHeaderNames = function getHeaderNames() {
// Returns a shallow copy of the current outgoing headers.
OutgoingMessage.prototype.getHeaders = function getHeaders() {
const headers = this[outHeadersKey];
- const ret = new StorageObject();
+ const ret = Object.create(null);
if (headers) {
const keys = Object.keys(headers);
for (var i = 0; i < keys.length; ++i) {