Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v9.x backport] tools, test: fix prof polyfill readline #18900

Closed
wants to merge 142 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
142 commits
Select commit Hold shift + click to select a range
81263f8
doc: add missing link references
vsemozhetbyt Jan 18, 2018
4e77b25
inspector: --inspect-brk for es modules
guybedford Jan 16, 2018
df34171
test: fix a bug & lint issues in inspector-helper
apapirovski Jan 22, 2018
200f626
test: fix flaky cluster unix socket test
bnoordhuis Jan 20, 2018
6b239bc
test: force context allocation in test module
hashseed Jan 23, 2018
bd2f210
http: switch on string values
sethbrenith Jan 24, 2018
4296c63
domain: further abstract usage in C++
apapirovski Jan 19, 2018
8ce2368
doc: Update tools/icu/README.md
srl295 Nov 10, 2017
3476b81
tools: fix icu readme lint error
apapirovski Jan 30, 2018
f8afbcd
doc: warn about GCM authenticity
tniessen Jan 25, 2018
a6cb576
doc: fix manpage warnings
silverwind Jan 29, 2018
99cbe44
doc: add pending-deprecation to COLLABORATOR_GUIDE
ChALkeR Jan 29, 2018
83295be
doc: reorder section on updating PR branch
ofrobots Jan 24, 2018
8c39ea3
src: fix vector subscript out of range
apapirovski Jan 30, 2018
c35eacc
url: simplify loop in parser
tniessen Jan 30, 2018
614619f
doc: add Gibson Fahnestock to TSC
Trott Jan 31, 2018
9ee15fa
n-api: change assert ok check to notStrictEqual.
nbdaaron Jan 27, 2018
75975c7
perf_hooks: add warning when too many entries in the timeline
jasnell Jan 10, 2018
0d6476b
doc: linkify missing types
vsemozhetbyt Jan 29, 2018
ce07810
test: move tmpdir to submodule of common
Trott Dec 25, 2017
447919a
test: fix flaky test-http-dns-error
bengl Oct 26, 2017
7e5035a
http: process headers after setting up agent
rvagg Oct 24, 2017
cf243f6
crypto: use non-deprecated v8::Object::Set
danbev Dec 6, 2017
7d077ea
benchmark: fix platform in basename-win32
BridgeAR Jan 23, 2018
5d680fb
benchmark: fix variables not being set
BridgeAR Jan 23, 2018
4e3f482
benchmark: (assert) refactor
BridgeAR Jan 23, 2018
edbf81a
benchmark: (buffer) refactor
BridgeAR Jan 23, 2018
084165a
benchmark: (crypto) refactor
BridgeAR Jan 23, 2018
8e83c31
benchmark: (url) refactor
BridgeAR Jan 23, 2018
f02f1d0
benchmark: (es) refactor
BridgeAR Jan 23, 2018
3f7041c
benchmark: (http(2)) refactor
BridgeAR Jan 23, 2018
6deaf5f
benchmark: (timers) refactor
BridgeAR Jan 23, 2018
6f87902
benchmark: refactor
BridgeAR Jan 23, 2018
874361d
src: free memory before re-setting URLHost value
prog1dev Jan 23, 2018
60ee303
tools: auto fix custom eslint rule
shobhitchittora Oct 31, 2017
c14d8b9
benchmark: cut down http benchmark run time
joyeecheung Jan 25, 2018
3776e82
doc: improve stream documentation
Jan 25, 2018
fd7d172
test: speed up parallel/test-tls-session-cache
addaleax Jan 29, 2018
d93bad8
lib: extract validation functions
timotew Jan 28, 2018
6cf450c
test: show pending exception error in napi tests
reccanti Jan 27, 2018
cea50ff
benchmark: shorten config name in http benchmark
joyeecheung Jan 30, 2018
029c097
lib: remove debugger dead code
liqyan Jan 22, 2018
e496ad6
src: allow --perf-(basic-)?prof in NODE_OPTIONS
Leko Dec 11, 2017
3c4802a
deps: update node-inspect to 1.11.3
Jan 24, 2018
2456716
benchmark: spread operator benchmark
jasnell Jan 29, 2018
ee2075f
test: mark test-inspector-stop-profile-after-done flaky
MylesBorins Feb 1, 2018
550fdac
async_hooks: clean up comments
ofrobots Jan 30, 2018
65f90d5
doc: move Brian White to TSC Emeriti list
Trott Jan 31, 2018
7910c00
stream: delete redundant code
Jan 14, 2018
4aff6a7
stream: delete redundant code
Jan 15, 2018
0f2a522
process: fix reading zero-length env vars on win32
addaleax Jan 30, 2018
caa197b
v8: add missing ',' in OpenBSD's 'sources' section.
qbit Jan 30, 2018
712084a
build: add cflags for OpenBSD, remove stray comma.
qbit Jan 30, 2018
46d0248
doc: streamline README intro
Trott Jan 31, 2018
4ff735e
string_decoder: reset decoder on end
jridgewell Feb 1, 2018
b658fb2
stream: delete unused code
Jan 21, 2018
9466558
n-api: implement wrapping using private properties
Jan 23, 2018
8d80974
net: remove redundant code from _writeGeneric()
lpinca Jan 29, 2018
a8843d7
test: add test for tls benchmarks
apapirovski Feb 1, 2018
564d7e9
http: remove domain specific code
apapirovski Jan 29, 2018
944e2c2
timers: remove domain specific code
apapirovski Jan 29, 2018
93ea05d
doc: remove removed apis from http2 docs
kjin Jan 29, 2018
b534b69
test: verify the shell option works properly on execFile
jvelezpo Jan 25, 2018
9b86080
win, build: fix intl-none option
poiru Jan 22, 2018
bafccd0
doc: improve http.request documentation
Zarel Jan 8, 2018
de64b0e
doc: shell option for the execFile and execFileSync functions
jvelezpo Jan 18, 2018
3174bd9
build: allow x86_64 as a dest_cpu alias for x64
rvagg Jan 9, 2018
e1fffbc
tools: non-Ascii linter for /lib only
SirR4T Jan 8, 2018
24d8ec6
src, lib: return promises from link
devsnek Jan 26, 2018
9075cb1
tools: add .mjs linting for Windows
vsemozhetbyt Feb 4, 2018
6bc4cd5
test: remove destructor from node_test_fixture
danbev Feb 2, 2018
d05c0a0
stream: cleanup() when unpiping all streams.
Jan 20, 2018
ea49b0d
n-api: wrap control flow macro in do/while
bnoordhuis Feb 2, 2018
722e33e
doc: expand on promises and async_hooks
ofrobots Feb 2, 2018
97b12e5
doc: remove usage of you in n-api doc
mhdawson Feb 2, 2018
7b1a9b2
doc: add section for strategic initiatives
mhdawson Nov 17, 2017
e40c3f7
doc: small typo in n-api.md
iSkore Feb 4, 2018
a7d1735
n-api: add methods to open/close callback scope
mhdawson Dec 13, 2017
232ea3e
n-api: remove extra reference from test
Feb 3, 2018
730a1ce
test: improve tests for test-http-url.parse
starkwang Feb 2, 2018
65398b9
doc: add introduce about cli options
starkwang Jan 31, 2018
a19fd95
build: add doc linting when runnning `make lint`
camilo86 Jan 31, 2018
9d3fbbe
doc: fix typo in n-api.md
vsemozhetbyt Feb 6, 2018
635ea60
src: fix crypto.pbkdf2 callback error argument
BufoViridis Jan 30, 2018
69aff5b
doc: modify the return value of request.write()
Feb 2, 2018
7cb5a7f
doc: update onboarding-extras
devsnek Feb 3, 2018
70a00fa
http: add options to http.createServer()
Oct 19, 2017
8180356
http2: add http fallback options to .createServer
hekike Oct 27, 2017
3e6398e
doc: fix typo in http2.md
vsemozhetbyt Feb 6, 2018
3a4266f
doc: add missing "changes" key in YAML comment
lpinca Feb 6, 2018
cad0406
tools: add fixer for prefer-assert-iferror.js
shobhitchittora Oct 31, 2017
f3bf159
test: do not check TXT content in test-dns-any
joyeecheung Feb 3, 2018
102dac8
test: fix flaky test-http2-session-unref
apapirovski Feb 5, 2018
5a6c57e
doc: be more explicit in the sypnosis
timotew Jan 4, 2018
27456ff
test: improve error message output
bshankar Feb 1, 2018
2ee0850
readline: use Date.now() and move test to parallel
apapirovski Feb 4, 2018
4deffa2
test: refactor test-http-abort-before-end
cjihrig Feb 1, 2018
60d1735
doc: fix link in https.md
vsemozhetbyt Feb 7, 2018
ae14478
doc: fix MDN links to avoid redirections
vsemozhetbyt Feb 7, 2018
00fbe9a
src: don't abort when package.json is a directory
bnoordhuis Jan 20, 2018
f6485d9
build: do not suppress output in make doc-only
joyeecheung Feb 1, 2018
a75f071
stream: fix misleading error message
lpinca Feb 6, 2018
e7f8b4b
benchmark: improve compare output
BridgeAR Feb 5, 2018
804393b
net: remove Socket.prototoype.read
addaleax Feb 4, 2018
5d54a04
test: fix flaky timers-block-eventloop test
apapirovski Feb 4, 2018
a03eeb2
test: properly tag anonymous namespaces
mhdawson Feb 5, 2018
d441904
doc: fix description of createDecipheriv
tniessen Feb 8, 2018
64aae93
doc: add missing meta for createCipheriv
tniessen Feb 8, 2018
c07ac3d
doc: fix links in YAML metadata of assert.md
vsemozhetbyt Feb 9, 2018
2369401
doc: add devsnek to collaborators
devsnek Feb 9, 2018
21ec460
http2: add req and res options to server creation
Oct 5, 2017
86c1ffb
doc: fix links to Style Guide and CPP Style Guide
justin0022 Feb 9, 2018
f7aab6c
src: add "icu::" prefix before ICU symbols
srl295 Feb 8, 2018
a799964
https: add extra options to Agent#getName()
princjef Oct 17, 2017
1794bb3
src: replace var for let / const.
estrada9166 Feb 8, 2018
d2c9557
fs: fix stack overflow in fs.readdirSync
joyeecheung Feb 8, 2018
df5e57a
doc: add history for url.parse
styfle Feb 9, 2018
4b2e96c
doc: fix exporting a function example
Feb 8, 2018
415e452
buffer: simplify check size in assertSize
Connormiha Feb 8, 2018
4eb31cf
build: no longer have v8-debug.h as dependency.
hashseed Feb 9, 2018
c875d17
doc: add error check to fs example
evanlucas Feb 9, 2018
6dd8e2a
test: fix flaky repl-timeout-throw
santigimeno Feb 10, 2018
368c378
doc: mark NAPI_AUTO_LENGTH as code
tniessen Feb 10, 2018
299a013
url: simplify constructor URLSearchParams. Remove needless check null
Connormiha Feb 10, 2018
b3a04c8
async_hooks: rename PromiseWrap.parentId
ofrobots Feb 8, 2018
93e8dde
tools: fix eslint isRequired
BridgeAR Feb 12, 2018
84c95c5
http2: use `_final` instead of `on('finish')`
addaleax Feb 7, 2018
495c412
fs: make URL paths no longer experimental
jasnell Feb 6, 2018
fe56ae3
test: add useful info to error msg and refactor
chinhuang007 Feb 2, 2018
d40e90a
test: fix and improve error message
kcaulfield94 Feb 1, 2018
8ba9c67
test: fix missing param in benchmark-timers
apapirovski Feb 12, 2018
cefadf1
doc: add mmarchini to collaborators
Feb 12, 2018
354c360
path: replace "magic" numbers by readable constants
daynin Feb 8, 2018
3bab4e4
test: add crypto check to test-benchmark-tls
danbev Feb 12, 2018
6661862
async_hooks: deprecate unsafe emit{Before,After}
ofrobots Feb 1, 2018
664a681
lib: provide proper deprecation code
BridgeAR Feb 10, 2018
2da7856
src: flatten ContextifyContext
devsnek Dec 9, 2017
0241959
vm: add modules
devsnek Jan 14, 2018
2e06702
src: factor out some common vm functions
TimothyGu Jan 13, 2018
837c91d
vm: flip Module#link's signature
devsnek Jan 31, 2018
0e105ae
loader: fix up #18394
devsnek Feb 1, 2018
1bd2161
tools, test: fix prof polyfill readline
killagu Feb 11, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
22 changes: 13 additions & 9 deletions COLLABORATOR_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,10 @@ Node.js uses three Deprecation levels:
being staged for deprecation in a future Node.js major release. An explicit
notice indicating the deprecated status is added to the API documentation
but no functional changes are implemented in the code. There will be no
runtime deprecation warnings emitted for such deprecations.
runtime deprecation warnings emitted for such deprecations by default.
Documentation-only deprecations may trigger a runtime warning when launched
with [`--pending-deprecation`][] flag (or its alternative,
`NODE_PENDING_DEPRECATION=1` environment variable).

* *Runtime Deprecation* refers to the use of process warnings emitted at
runtime the first time that a deprecated API is used. A command-line
Expand Down Expand Up @@ -593,20 +596,20 @@ Validate that the commit message is properly formatted using
$ git rev-list upstream/master...HEAD | xargs core-validate-commit
```

Optional: When landing your own commits, force push the amended commit to the
branch you used to open the pull request. If your branch is called `bugfix`,
then the command would be `git push --force-with-lease origin master:bugfix`.
When the pull request is closed, this will cause the pull request to
show the purple merged status rather than the red closed status that is
usually used for pull requests that weren't merged.

Time to push it:

```text
$ git push upstream master
```
* Optional: Force push the amended commit to the branch you used to
open the pull request. If your branch is called `bugfix`, then the
command would be `git push --force-with-lease origin master:bugfix`.
When the pull request is closed, this will cause the pull request to
show the purple merged status rather than the red closed status that is
usually used for pull requests that weren't merged. Only do this when
landing your own contributions.

* Close the pull request with a "Landed in `<commit hash>`" comment. If
Close the pull request with a "Landed in `<commit hash>`" comment. If
your pull request shows the purple merged status then you should still
add the "Landed in <commit hash>..<commit hash>" comment if you added
multiple commits.
Expand Down Expand Up @@ -744,6 +747,7 @@ LTS working group and the Release team.
[backporting guide]: doc/guides/backporting-to-release-lines.md
[Stability Index]: doc/api/documentation.md#stability-index
[Enhancement Proposal]: https://github.com/nodejs/node-eps
[`--pending-deprecation`]: doc/api/cli.md#--pending-deprecation
[git-username]: https://help.github.com/articles/setting-your-username-in-git/
[`node-core-utils`]: https://github.com/nodejs/node-core-utils
[TSC]: https://github.com/nodejs/TSC
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ doc-only: $(apidoc_dirs) $(apiassets) ## Builds the docs with the local or the
if [ ! -d doc/api/assets ]; then \
$(MAKE) tools/doc/node_modules/js-yaml/package.json; \
fi;
@$(MAKE) -s $(apidocs_html) $(apidocs_json)
@$(MAKE) $(apidocs_html) $(apidocs_json)

.PHONY: doc
doc: $(NODE_EXE) doc-only
Expand Down Expand Up @@ -1183,6 +1183,7 @@ lint: ## Run JS, C++, MD and doc linters.
$(MAKE) lint-js || EXIT_STATUS=$$? ; \
$(MAKE) lint-cpp || EXIT_STATUS=$$? ; \
$(MAKE) lint-addon-docs || EXIT_STATUS=$$? ; \
$(MAKE) lint-md || EXIT_STATUS=$$? ; \
exit $$EXIT_STATUS
CONFLICT_RE=^>>>>>>> [0-9A-Fa-f]+|^<<<<<<< [A-Za-z]+

Expand Down
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
<a title="CII Best Practices" href="https://bestpractices.coreinfrastructure.org/projects/29"><img src="https://bestpractices.coreinfrastructure.org/projects/29/badge"></a>
</p>

Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js
uses an event-driven, non-blocking I/O model that makes it lightweight and
efficient. The Node.js package ecosystem, [npm][], is the largest ecosystem of
open source libraries in the world.
Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. For
more information on using Node.js, see the
[Node.js Website][].

The Node.js project is supported by the
[Node.js Foundation](https://nodejs.org/en/foundation/). Contributions,
Expand Down Expand Up @@ -245,6 +244,8 @@ For more information about the governance of the Node.js project, see
**Franziska Hinkelmann** &lt;franziska.hinkelmann@gmail.com&gt; (she/her)
* [Fishrock123](https://github.com/Fishrock123) -
**Jeremiah Senkpiel** &lt;fishrock123@rocketmail.com&gt;
* [gibfahn](https://github.com/gibfahn) -
**Gibson Fahnestock** &lt;gibfahn@gmail.com&gt; (he/him)
* [indutny](https://github.com/indutny) -
**Fedor Indutny** &lt;fedor.indutny@gmail.com&gt;
* [jasnell](https://github.com/jasnell) -
Expand All @@ -255,8 +256,6 @@ For more information about the governance of the Node.js project, see
**Matteo Collina** &lt;matteo.collina@gmail.com&gt; (he/him)
* [mhdawson](https://github.com/mhdawson) -
**Michael Dawson** &lt;michael_dawson@ca.ibm.com&gt; (he/him)
* [mscdex](https://github.com/mscdex) -
**Brian White** &lt;mscdex@mscdex.net&gt;
* [MylesBorins](https://github.com/MylesBorins) -
**Myles Borins** &lt;myles.borins@gmail.com&gt; (he/him)
* [ofrobots](https://github.com/ofrobots) -
Expand All @@ -282,6 +281,8 @@ For more information about the governance of the Node.js project, see
**Isaac Z. Schlueter** &lt;i@izs.me&gt;
* [joshgav](https://github.com/joshgav) -
**Josh Gavant** &lt;josh.gavant@outlook.com&gt;
* [mscdex](https://github.com/mscdex) -
**Brian White** &lt;mscdex@mscdex.net&gt;
* [nebrius](https://github.com/nebrius) -
**Bryan Hughes** &lt;bryan@nebri.us&gt;
* [orangemocha](https://github.com/orangemocha) -
Expand Down Expand Up @@ -339,6 +340,8 @@ For more information about the governance of the Node.js project, see
**Daniel Bevenius** &lt;daniel.bevenius@gmail.com&gt;
* [DavidCai1993](https://github.com/DavidCai1993) -
**David Cai** &lt;davidcai1993@yahoo.com&gt; (he/him)
* [devsnek](https://github.com/devsnek) -
**Gus Caplan** &lt;me@gus.host&gt; (he/him)
* [edsadr](https://github.com/edsadr) -
**Adrian Estrada** &lt;edsadr@gmail.com&gt; (he/him)
* [eljefedelrodeodeljefe](https://github.com/eljefedelrodeodeljefe) -
Expand Down Expand Up @@ -423,6 +426,8 @@ For more information about the governance of the Node.js project, see
**Mikeal Rogers** &lt;mikeal.rogers@gmail.com&gt;
* [misterdjules](https://github.com/misterdjules) -
**Julien Gilli** &lt;jgilli@nodejs.org&gt;
* [mmarchini](https://github.com/mmarchini) -
**Matheus Marchini** &lt;matheus@sthima.com&gt;
* [mscdex](https://github.com/mscdex) -
**Brian White** &lt;mscdex@mscdex.net&gt;
* [MylesBorins](https://github.com/MylesBorins) -
Expand Down Expand Up @@ -590,12 +595,13 @@ Previous releases may also have been signed with one of the following GPG keys:

* [Contributing to the project][]
* [Working Groups][]
* [Strategic Initiatives][]

[npm]: https://www.npmjs.com
[Code of Conduct]: https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md
[Contributing to the project]: CONTRIBUTING.md
[Node.js Help]: https://github.com/nodejs/help
[Node.js Website]: https://nodejs.org/en/
[Questions tagged 'node.js' on StackOverflow]: https://stackoverflow.com/questions/tagged/node.js
[Working Groups]: https://github.com/nodejs/TSC/blob/master/WORKING_GROUPS.md
[Strategic Initiatives]: https://github.com/nodejs/TSC/blob/master/Strategic-Initiatives.md
[#node.js channel on chat.freenode.net]: https://webchat.freenode.net?channels=node.js&uio=d4
2 changes: 1 addition & 1 deletion benchmark/_http-benchmarkers.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ exports.run = function(options, callback) {
port: exports.PORT,
path: '/',
connections: 100,
duration: 10,
duration: 5,
benchmarker: exports.default_http_benchmarker
}, options);
if (!options.benchmarker) {
Expand Down
45 changes: 8 additions & 37 deletions benchmark/assert/deepequal-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ const bench = common.createBenchmark(main, {
});

function main({ len, n, method }) {
var i;

const data = Buffer.allocUnsafe(len + 1);
const actual = Buffer.alloc(len);
const expected = Buffer.alloc(len);
Expand All @@ -24,40 +22,13 @@ function main({ len, n, method }) {
data.copy(expected);
data.copy(expectedWrong);

switch (method) {
case '':
// Empty string falls through to next line as default, mostly for tests.
case 'deepEqual':
bench.start();
for (i = 0; i < n; ++i) {
// eslint-disable-next-line no-restricted-properties
assert.deepEqual(actual, expected);
}
bench.end(n);
break;
case 'deepStrictEqual':
bench.start();
for (i = 0; i < n; ++i) {
assert.deepStrictEqual(actual, expected);
}
bench.end(n);
break;
case 'notDeepEqual':
bench.start();
for (i = 0; i < n; ++i) {
// eslint-disable-next-line no-restricted-properties
assert.notDeepEqual(actual, expectedWrong);
}
bench.end(n);
break;
case 'notDeepStrictEqual':
bench.start();
for (i = 0; i < n; ++i) {
assert.notDeepStrictEqual(actual, expectedWrong);
}
bench.end(n);
break;
default:
throw new Error('Unsupported method');
// eslint-disable-next-line no-restricted-properties
const fn = method !== '' ? assert[method] : assert.deepEqual;
const value2 = method.includes('not') ? expectedWrong : expected;

bench.start();
for (var i = 0; i < n; ++i) {
fn(actual, value2);
}
bench.end(n);
}
2 changes: 1 addition & 1 deletion benchmark/assert/deepequal-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,6 @@ function main({ n, len, method }) {
benchmark(assert.notDeepEqual, n, values, values2);
break;
default:
throw new Error('Unsupported method');
throw new Error(`Unsupported method ${method}`);
}
}
44 changes: 8 additions & 36 deletions benchmark/assert/deepequal-object.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,47 +28,19 @@ function createObj(source, add = '') {
function main({ size, n, method }) {
// TODO: Fix this "hack". `n` should not be manipulated.
n = n / size;
var i;

const source = Array.apply(null, Array(size));
const actual = createObj(source);
const expected = createObj(source);
const expectedWrong = createObj(source, '4');

switch (method) {
case '':
// Empty string falls through to next line as default, mostly for tests.
case 'deepEqual':
bench.start();
for (i = 0; i < n; ++i) {
// eslint-disable-next-line no-restricted-properties
assert.deepEqual(actual, expected);
}
bench.end(n);
break;
case 'deepStrictEqual':
bench.start();
for (i = 0; i < n; ++i) {
assert.deepStrictEqual(actual, expected);
}
bench.end(n);
break;
case 'notDeepEqual':
bench.start();
for (i = 0; i < n; ++i) {
// eslint-disable-next-line no-restricted-properties
assert.notDeepEqual(actual, expectedWrong);
}
bench.end(n);
break;
case 'notDeepStrictEqual':
bench.start();
for (i = 0; i < n; ++i) {
assert.notDeepStrictEqual(actual, expectedWrong);
}
bench.end(n);
break;
default:
throw new Error('Unsupported method');
// eslint-disable-next-line no-restricted-properties
const fn = method !== '' ? assert[method] : assert.deepEqual;
const value2 = method.includes('not') ? expectedWrong : expected;

bench.start();
for (var i = 0; i < n; ++i) {
fn(actual, value2);
}
bench.end(n);
}
69 changes: 22 additions & 47 deletions benchmark/assert/deepequal-prims-and-objs-big-array-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,19 @@ const bench = common.createBenchmark(main, {
]
});

function run(fn, n, actual, expected) {
bench.start();
for (var i = 0; i < n; ++i) {
fn(actual, expected);
}
bench.end(n);
}

function main({ n, len, primitive, method }) {
const prim = primValues[primitive];
const actual = [];
const expected = [];
const expectedWrong = [];
var i;

for (var x = 0; x < len; x++) {
actual.push(prim);
Expand All @@ -51,69 +58,37 @@ function main({ n, len, primitive, method }) {
const expectedWrongSet = new Set(expectedWrong);

switch (method) {
// Empty string falls through to next line as default, mostly for tests.
case '':
// Empty string falls through to next line as default, mostly for tests.
case 'deepEqual_Array':
bench.start();
for (i = 0; i < n; ++i) {
// eslint-disable-next-line no-restricted-properties
assert.deepEqual(actual, expected);
}
bench.end(n);
// eslint-disable-next-line no-restricted-properties
run(assert.deepEqual, n, actual, expected);
break;
case 'deepStrictEqual_Array':
bench.start();
for (i = 0; i < n; ++i) {
assert.deepStrictEqual(actual, expected);
}
bench.end(n);
run(assert.deepStrictEqual, n, actual, expected);
break;
case 'notDeepEqual_Array':
bench.start();
for (i = 0; i < n; ++i) {
// eslint-disable-next-line no-restricted-properties
assert.notDeepEqual(actual, expectedWrong);
}
bench.end(n);
// eslint-disable-next-line no-restricted-properties
run(assert.notDeepEqual, n, actual, expectedWrong);
break;
case 'notDeepStrictEqual_Array':
bench.start();
for (i = 0; i < n; ++i) {
assert.notDeepStrictEqual(actual, expectedWrong);
}
bench.end(n);
run(assert.notDeepStrictEqual, n, actual, expectedWrong);
break;
case 'deepEqual_Set':
bench.start();
for (i = 0; i < n; ++i) {
// eslint-disable-next-line no-restricted-properties
assert.deepEqual(actualSet, expectedSet);
}
bench.end(n);
// eslint-disable-next-line no-restricted-properties
run(assert.deepEqual, n, actualSet, expectedSet);
break;
case 'deepStrictEqual_Set':
bench.start();
for (i = 0; i < n; ++i) {
assert.deepStrictEqual(actualSet, expectedSet);
}
bench.end(n);
run(assert.deepStrictEqual, n, actualSet, expectedSet);
break;
case 'notDeepEqual_Set':
bench.start();
for (i = 0; i < n; ++i) {
// eslint-disable-next-line no-restricted-properties
assert.notDeepEqual(actualSet, expectedWrongSet);
}
bench.end(n);
// eslint-disable-next-line no-restricted-properties
run(assert.notDeepEqual, n, actualSet, expectedWrongSet);
break;
case 'notDeepStrictEqual_Set':
bench.start();
for (i = 0; i < n; ++i) {
assert.notDeepStrictEqual(actualSet, expectedWrongSet);
}
bench.end(n);
run(assert.notDeepStrictEqual, n, actualSet, expectedWrongSet);
break;
default:
throw new Error('Unsupported method');
throw new Error(`Unsupported method "${method}"`);
}
}
Loading