Use a unique file name for each benchmark. Running benchmarks
simultaneously may be a bit of an unusual use case, but there are use
cases, such as stress testing `test/parallel/test-benchmark-fs.js`.
PR-URL: https://github.com/nodejs/node/pull/16776
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
test-https-server-keep-alive-timeout relies on server timeouts and
whatnot that will be inherently unreliable on a busy host. The test
fails when run with a high `-j` value and higher `--repeat` value passed
to `tools/test.py`. Move the test to `sequential`.
PR-URL: https://github.com/nodejs/node/pull/16775
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Khaidi Chu <i@2333.moe>
Reviewed-By: James M Snell <jasnell@gmail.com>
This removes the `process._needImmediateCallback` property
and its semantics of having a 1/0 switch that tells C++ whether
immediates are currently scheduled.
Instead, a counter keeping track of all immediates is created,
that can be increased on `setImmediate()` or decreased when an
immediate is run or cleared.
This is faster, because rather than reading/writing a C++ getter,
this operation can be performed as a direct memory read/write via
a typed array. The only C++ call that is left to make is
activating the native handles upon creation of the first
`Immediate` after the queue is empty.
One other (good!) side-effect is that `immediate._destroyed` now
reliably tells whether an `immediate` is still scheduled to run or not.
Also, as a nice extra, this should make it easier to implement
an internal variant of `setImmediate` for C++ that piggybacks
off the same mechanism, which should be useful at least for
async hooks and HTTP/2.
Benchmark results:
$ ./node benchmark/compare.js --new ./node --old ./node-master-1b093cb93df0 --runs 10 --filter immediate timers | Rscript benchmark/compare.R
[00:08:53|% 100| 4/4 files | 20/20 runs | 1/1 configs]: Done
improvement confidence p.value
timers/immediate.js type="breadth" thousands=2000 25.61 % ** 1.432301e-03
timers/immediate.js type="breadth1" thousands=2000 7.66 % 1.320233e-01
timers/immediate.js type="breadth4" thousands=2000 4.61 % 5.669053e-01
timers/immediate.js type="clear" thousands=2000 311.40 % *** 3.896291e-07
timers/immediate.js type="depth" thousands=2000 17.54 % ** 9.755389e-03
timers/immediate.js type="depth1" thousands=2000 17.09 % *** 7.176229e-04
timers/set-immediate-breadth-args.js millions=5 10.63 % * 4.250034e-02
timers/set-immediate-breadth.js millions=10 20.62 % *** 9.150439e-07
timers/set-immediate-depth-args.js millions=10 17.97 % *** 6.819135e-10
PR-URL: https://github.com/nodejs/node/pull/17064
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Add a Support section, borrowing heavily from wp-cli project.
Move stuff about contributing to Node.js to the bottom as vastly more
users are interested in using Node.js and getting help with Node.js than
contributing to Node.js. Information still belongs, just not at the top.
(Many people will know to look in CONTRIBUTING.md anyway.)
PR-URL: https://github.com/nodejs/node/pull/16533
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Remove the practice of starting most error descriptions with "Used when"
or wordier variations.
Change errors of the form:
> Used when the type of an asynchronous resource is invalid.
...to:
> The type of an asynchronous resource was invalid.
Change errors of the form:
> The `'ERR_INVALID_CURSOR_POS'` is thrown specifically when a cursor on
> a given stream is attempted to move to a specified row without a
> specified column.
...to:
> A cursor on a given stream cannot be moved to a specified row without
> a specified column.
PR-URL: https://github.com/nodejs/node/pull/16954
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This commit renames req-wrap to req_wrap consitency with other
c++ source files.
PR-URL: https://github.com/nodejs/node/pull/17022
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
This commit renames base-object to base_object for consitency with other
c++ source files.
PR-URL: https://github.com/nodejs/node/pull/17022
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
This commit renames async-wrap to async_wrap for consitency with other
c++ source files.
PR-URL: https://github.com/nodejs/node/pull/17022
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
PR-URL: https://github.com/nodejs/node/pull/16923
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Use an std::unique_ptr for variables that are deleted
right after creation.
Since the destructor of InspectorTimer is private
but needed by the unique_ptr, define deleter_type as friend.
PR-URL: https://github.com/nodejs/node/pull/17020
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Currently the cctest target will fail on linux when configured
--with-dtrace:
/node-v9.2.0/out/Release/obj.target/node/src/node_dtrace.o:
In function `node::DTRACE_NET_SERVER_CONNECTION(
v8::FunctionCallbackInfo<v8::Value> const&)':
node_dtrace.cc:(.text+0x103): undefined reference to
`node_net__server__connection_semaphore'
/node-v9.2.0/out/Release/obj.target/node/src/node_dtrace.o:
In function `node::DTRACE_NET_STREAM_END(
v8::FunctionCallbackInfo<v8::Value> const&)':
...
This is because node_dtrace_provider.o is not linked by the cctest
target.
This commit tries to fix and simplify the conditions in cctest target
so that node_dtrace.o is included for all operating systems that support
dtrace, include node_dtrace_ustack.o for all operating systems except
mac and linux, and include node_dtrace_provider.o for all operating
systems except mac.
PR-URL: https://github.com/nodejs/node/pull/17039
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Change documentation-only deprecation for custom inspection using
`object.inspect` property to a runtime deprecation.
This is a breaking change. Custom inspection via `object.inspect` is
deprecated because there is a more robust Symbol-based alternative to
`.inspect` and the custom inspection via `object.inspect` feature means
that people can accidentally break `console.log()` simply by attaching a
`.inspect` property to their objects. Note that since this is a
deprecation, the custom inspection will still work. The breaking change
is simply the printing of a warning which could alarm users, break tests
or other things that might be dependent on specific output, etc.
PR-URL: https://github.com/nodejs/node/pull/16393
Ref: https://github.com/nodejs/node/issues/15549
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
If another function has already emitted the deprecation warning with the
same code as the warning that is about to be emitted, do not emit the
warning.
This is a breaking change. Previously, different functions could emit
the same deprecation warning multiple times. This was a known bug rather
than a feature, but this change is being treated as a breaking change
out of caution. Identical deprecation warnings should not be emitted.
PR-URL: https://github.com/nodejs/node/pull/16393
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Improve documentation for `util.deprecate()`. In particular, provide
complete function signature, document arguments, and document return
value.
PR-URL: https://github.com/nodejs/node/pull/16393
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
In test-util-inspect, apply ESLint exception for accessor-pairs rule
narrowly. It had been applied to nearly the whole file, but is only
needed for two lines.
PR-URL: https://github.com/nodejs/node/pull/16393
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Commit d217b2850e ("async_hooks: add trace events to async_hooks")
used `NODE_MODULE_CONTEXT_AWARE_BUILTIN()` instead.
After commit 8680bb9f1a ("src: explicitly register built-in modules")
it no longer works for static library builds so remove it.
PR-URL: https://github.com/nodejs/node/pull/17071
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Make a REPL tab completion test pass in coverage mode by using
`Uin` as the common prefix of all `Uint*Array` globals instead
of `co` which could be a prefix for `console` and `coverage`,
so it doesn't expand the way it's expected to in coverage mode.
PR-URL: https://github.com/nodejs/node/pull/17082
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Remove commented-out code that is leftover from a refactoring.
PR-URL: https://github.com/nodejs/node/pull/17023
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Lance Ball <lball@redhat.com>
In cases where libraries create AsyncResources which may be emitting
more events depending on usage, the only way to ensure that destroy is
called properly is by calling it when the resource gets garbage
collected.
Fixes: https://github.com/nodejs/node/issues/16153
PR-URL: https://github.com/nodejs/node/pull/16998
Fixes: https://github.com/nodejs/node/issues/16153
Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Use smart pointers instead of raw pointers for StdioPipes.
Also, use a smart pointer for the array holding them.
PR-URL: https://github.com/nodejs/node/pull/17030
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Mea culpa, somehow I managed to drop the documentation commit while
merging the pull request. This should have been included in commit
74023c072c ("fs: expose realpath(3) bindings") from this month.
PR-URL: https://github.com/nodejs/node/pull/17059
Refs: https://github.com/nodejs/node/pull/15776
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
This will allow trace event to record timing information for all
asynchronous operations that are observed by async_hooks.
PR-URL: https://github.com/nodejs/node/pull/15538
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
The Cpp style guide is growing. IMHO, a Table of Contents makes
it easier to navigate.
PR-URL: https://github.com/nodejs/node/pull/17052
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Use std::unique_ptr instead of raw pointers for the
tracing_agent_ in node.cc. This makes ownership clearer and we
don't risk a memory leak.
PR-URL: https://github.com/nodejs/node/pull/17012
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
The motivation for this commit is to enable projects embedding Node.js
and building with --enable-static to be able to run the test suite and
linter.
Currently when building with --enable-static no node executable
will be created which means that the tests (apart from the cctest) and
linter cannot be run.
This is currently a work in progress and works on MacOS but I need to
run the CI, and manually on different environments to verify that it
works as expected.
PR-URL: https://github.com/nodejs/node/pull/14986
Refs: https://github.com/nodejs/node/issues/14158
Refs: https://github.com/nodejs/node/pull/14892
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Currenlty the test target will echo additional information that might
not be that useful, for example:
make doc-only
make[1]: Nothing to be done for `doc-only'.
make lint
Running JS linter...
Running C++ linter...
Total errors found: 0
make[2]: Nothing to be done for `lint-md'.
Running C++ linter on addon docs...
Total errors found: 0
make cctest
This commit suggests reducing this to:
make -s doc-only
make -s lint
Running JS linter...
Running C++ linter...
Running C++ linter on addon docs...
Total errors found: 0
make -s cctest
PR-URL: https://github.com/nodejs/node/pull/17010
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Instead of raw pointerns, use std::unique_ptr for PBKDF2Request and
RandomBytesRequest. This makes ownership more clear.
PR-URL: https://github.com/nodejs/node/pull/17000
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Tests a basic WebAssembly module that adds two numbers.
wasm example from the WebAssembly/wabt repo licensed
Apache 2.0.
Refs: 49b7984544/demo/wat2wasm/examples.js (L27-L32)
PR-URL: https://github.com/nodejs/node/pull/16760
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
PR-URL: https://github.com/nodejs/node/pull/16951
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Replaced _readableState.highWaterMark with a .readableHighWaterMark
getter and _writableState.highWaterMark with a .writableHighWaterMark
getter.
The getters are non-enumerable because they break some prototype
manipulation that happen in the ecosystem.
Ref: https://github.com/nodejs/node/issues/445.
PR-URL: https://github.com/nodejs/node/pull/12860
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
It's not wholly clear what commit introduced the regression but between
v8.4.0 and v8.5.0 the 'resize' event stopped getting emitted when the
tty was resized.
The SIGWINCH event listener apparently was being installed before the
support code for `process.on('SIGWINCH', ...)` was. Fix that by moving
said support code to real early in the bootstrap process.
This commit also seems to fix a Windows-only "write EINVAL" error for
reasons even less well-understood...
Fixes: https://github.com/nodejs/node/issues/16141
Fixes: https://github.com/nodejs/node/issues/16194
PR-URL: https://github.com/nodejs/node/pull/16225
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Introduced in commit 6ee985f311 ("tls: implement clientCertEngine
option") which was merged November 11.
PR-URL: https://github.com/nodejs/node/pull/16965
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
It was computing the size of the pointer, not the size of the pointed-to
object.
Introduced in commit 727b2911ec ("src,dns: refactor cares_wrap to avoid
global state".)
PR-URL: https://github.com/nodejs/node/pull/17014
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Move the logic from the previous commit to C++ land in order to avoid
creating a new string when we know we won't parse it anyway.
PR-URL: https://github.com/nodejs/node/pull/15767
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
If the package.json does not contain the string '"main"', skip parsing
it to JSON.
Note that this changes the behavior of the module loader in the presence
of package.json files that don't contain legal JSON. Such files used to
throw an exception but now they are simply ignored unless they contain a
"main" property.
To me, that seems like a good trade-off: I observe a 25% reduction in
start-up time on a medium-sized application[0].
[0] https://github.com/strongloop/sls-sample-app
PR-URL: https://github.com/nodejs/node/pull/15767
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>