-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "util: move util._extend to eol"
This reverts commit ac97a53. PR-URL: #53429 Refs: tape-testing/tape#607 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: James M Snell <jasnell@gmail.com>
- Loading branch information
1 parent
ee8e841
commit b5aae52
Showing
7 changed files
with
93 additions
and
7 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
'use strict'; | ||
|
||
const common = require('../common.js'); | ||
const util = require('util'); | ||
|
||
const bench = common.createBenchmark(main, { | ||
type: ['extend', 'assign'], | ||
n: [10e4], | ||
}); | ||
|
||
function main({ n, type }) { | ||
let fn; | ||
if (type === 'extend') { | ||
fn = util._extend; | ||
} else if (type === 'assign') { | ||
fn = Object.assign; | ||
} | ||
|
||
// Force-optimize the method to test so that the benchmark doesn't | ||
// get disrupted by the optimizer kicking in halfway through. | ||
for (let i = 0; i < type.length * 10; i += 1) | ||
fn({}, process.env); | ||
|
||
const obj = new Proxy({}, { set: function(a, b, c) { return true; } }); | ||
|
||
bench.start(); | ||
for (let j = 0; j < n; j += 1) | ||
fn(obj, process.env); | ||
bench.end(n); | ||
} |
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
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
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
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
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