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>
This commit is contained in:
Timothy Gu 2017-03-19 16:11:10 -07:00
parent 14a91957f8
commit cfc8422a68
6 changed files with 19 additions and 34 deletions

View file

@ -25,7 +25,6 @@
const { Buffer } = require('buffer');
const {
StorageObject,
hexTable,
isHexTable
} = require('internal/querystring');
@ -281,7 +280,7 @@ const defEqCodes = [61]; // =
// Parse a key/val string.
function parse(qs, sep, eq, options) {
const obj = new StorageObject();
const obj = Object.create(null);
if (typeof qs !== 'string' || qs.length === 0) {
return obj;