Commit Graph

888 Commits

Author SHA1 Message Date
Rich Trott
cf6996458b
benchmark,test: use Object.hasOwn() where applicable
Refs: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwn

PR-URL: https://github.com/nodejs/node/pull/41229
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2021-12-20 04:03:58 +00:00
Brian White
ed01811e71
benchmark: increase crypto DSA keygen params
OpenSSL 3.0 increased the minimum values for these parameters.

PR-URL: https://github.com/nodejs/node/pull/40416
Fixes: https://github.com/nodejs/node/issues/40410
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
2021-10-16 06:03:10 -04:00
XadillaX
0ee0ed12c1 benchmark: add util.toUSVString()'s benchmark
PR-URL: https://github.com/nodejs/node/pull/40203
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
2021-09-27 17:24:19 +08:00
Rich Trott
a6a5d4bda0 doc: update benchmarks README.md for upcoming linting/formatting
PR-URL: https://github.com/nodejs/node/pull/40158
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2021-09-21 17:02:07 -07:00
Stephen Belanger
926152a38c async_hooks: use resource stack for AsyncLocalStorage run
PR-URL: https://github.com/nodejs/node/pull/39890
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
2021-08-31 17:04:35 +00:00
legendecas
062f8e3730
perf_hooks: web performance timeline compliance
All API introduced in this PR are compliant with web
[performance-timeline](https://w3c.github.io/performance-timeline)
spec. "performance-timeline" is listed as supported web spec in the doc
https://nodejs.org/docs/latest/api/perf_hooks.html#perf_hooks_performance_measurement_apis.

Changes summary:
1. Add new supported wpt test subsets: user-timing and
  performance-timeline.
2. Add support for `Performance.getEntries`,
  `Performance.getEntriesByName` and `Performance.getEntriesByType`
  to synchronously fetch buffered performance entries. This means
  the user should invoke `Performance.clearMarks` and
  `Performance.clearMeasures` to clear buffered entries to prevent from
  those entries been kept alive forever.
3. Add support (again after https://github.com/nodejs/node/pull/37136)
  for `buffered` flags for `PerformanceObserver`.
3. Fixes `PerformanceMark` and `PerformanceMeasure` wpt compliance
  issues.
4. Only user-created performance entries will be buffered globally. This
  behavior should be compliant with
  https://w3c.github.io/timing-entrytypes-registry/#registry.

With the new ability to fetch user-created performance entries
synchronously, the issues raised in
https://github.com/nodejs/diagnostics/issues/464#issuecomment-861920116
could also be fixed.

PR-URL: https://github.com/nodejs/node/pull/39297
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-07-25 23:43:31 +08:00
Michaël Zasso
2a1dea8a22
benchmark: output JSON-compatible numbers
This is to simplify the implementation of a JavaScript version of the
compare.R script.

PR-URL: https://github.com/nodejs/node/pull/38778
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
2021-05-25 13:36:47 -07:00
Antoine du Hamel
ba84524a7c benchmark: fix http elapsed time
Since commit 4e9ad206e2, elapsed time is expected to be a BigInt
instead of an array.

Refs: https://github.com/nodejs/node/pull/38369

PR-URL: https://github.com/nodejs/node/pull/38743
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
2021-05-23 14:52:14 +08:00
Voltrex
6e6663b8a4
events: use nullish coalencing operator
PR-URL: https://github.com/nodejs/node/pull/38328
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2021-05-17 12:26:29 -07:00
Antoine du Hamel
26e318a321
doc: use HEAD instead of master for links
PR-URL: https://github.com/nodejs/node/pull/38518
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
2021-05-05 10:45:30 +02:00
Antoine du Hamel
0c879cb7b8 benchmark: avoid using console.log()
PR-URL: https://github.com/nodejs/node/pull/38370
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2021-04-27 12:28:30 +02:00
Antoine du Hamel
4e9ad206e2
benchmark: use process.hrtime.bigint()
PR-URL: https://github.com/nodejs/node/pull/38369
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-04-26 11:44:23 -07:00
Brian White
0180fc5b9b
benchmark: improve compare.R output
PR-URL: https://github.com/nodejs/node/pull/38118
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2021-04-12 14:28:46 -07:00
Filip Skokan
e8cb6446ef crypto: reconcile oneshot sign/verify sync and async implementations
PR-URL: https://github.com/nodejs/node/pull/37816
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2021-04-08 10:08:26 +02:00
Tobias Nießen
5dae7d6758 crypto: add buffering to randomInt
PR-URL: https://github.com/nodejs/node/pull/35110
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Andrey Pechkurov <apechkurov@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2021-04-03 15:37:53 +02:00
Rich Trott
448158e0f8 tools: simplify eslint comma-dangle configuration
Remove comma-dangle settings in benchmark/.eslintrc.yaml as they are the
same as what is set in .eslintrc.js.

PR-URL: https://github.com/nodejs/node/pull/37850
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-03-23 13:15:09 -07:00
wwwzbwcom
2c251ff33a stream: make Readable.from performance better
PR-URL: https://github.com/nodejs/node/pull/37609
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2021-03-22 11:19:35 +02:00
Nitzan Uziely
a97f01ea8c benchmark: add benchmark for fsPromises.writeFile
added fs.promises.writeFile benchmark

PR-URL: https://github.com/nodejs/node/pull/37610
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2021-03-13 13:41:00 +01:00
Nitzan Uziely
b9fd4eb651 fs: add promisified readFile benchmark
add a benchmark for fs.promises.readFile

PR-URL: https://github.com/nodejs/node/pull/37608
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2021-03-10 18:00:58 +02:00
James M Snell
f3eb224c83
perf_hooks: complete overhaul of the implementation
* Update the user timing implementation to conform to
  User Timing Level 3.
* Reimplement user timing and timerify with pure JavaScript
  implementations
* Simplify the C++ implementation for gc and http2 perf
* Runtime deprecate additional perf entry properties
  in favor of the standard detail argument
* Disable the `buffered` option on PerformanceObserver,
  all entries are queued and dispatched on setImmediate.
  Only entries with active observers are buffered.
* This does remove the user timing and timerify
  trace events. Because the trace_events are still
  considered experimental, those can be removed without
  a deprecation cycle. They are removed to improve
  performance and reduce complexity.

Old: `perf_hooks/usertiming.js n=100000: 92,378.01249733355`
New: perf_hooks/usertiming.js n=100000: 270,393.5280638482`

PR-URL: https://github.com/nodejs/node/pull/37136
Refs: https://github.com/nodejs/diagnostics/issues/464
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2021-02-22 08:46:11 -08:00
zhangyongsheng
aecd5ebf49 module: only set cache when finding module succeeds
PR-URL: https://github.com/nodejs/node/pull/36642
Fixes: https://github.com/nodejs/node/issues/36638
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-02-12 22:08:40 +08:00
bcoe
8c9dc4e9e6
benchmark: add benchmark for NODE_V8_COVERAGE
PR-URL: https://github.com/nodejs/node/pull/36972
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
2021-01-27 14:31:37 -08:00
Tobias Nießen
9da3f217ef
benchmark: make output RFC 4180 compliant
PR-URL: https://github.com/nodejs/node/pull/37038
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2021-01-25 07:05:31 -08:00
Tobias Nießen
ea2e2dfc52
benchmark: improve explanations in R script
PR-URL: https://github.com/nodejs/node/pull/36995
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Pooja D P <Pooja.D.P@ibm.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-01-22 19:41:42 -08:00
raisinten
3dce4fb85f
test,benchmark: stop requiring URL and URLSearchParams
Since the URL and URLSearchParams classes are available in the
global object, there is no need to require them from 'url'.

PR-URL: https://github.com/nodejs/node/pull/36927
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2021-01-18 13:44:33 -08:00
Rich Trott
1c4fa9a48a benchmark: fix http2 benchmarks
Fixes: https://github.com/nodejs/node/issues/36746

PR-URL: https://github.com/nodejs/node/pull/36871
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2021-01-10 20:26:54 -08:00
James M Snell
0008a675ff crypto: implement randomuuid
Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/36729
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Ben Coe <bencoe@gmail.com>
2021-01-07 12:44:36 -08:00
Rich Trott
1e35d5802a benchmark: fix http/headers.js with test-double
The http/headers.js benchmark fails if wrk or autocannon are not
installed. This is because the benchmark exceeds the default permissible
length for HTTP headers. Reduce the largest benchmarks to fit within the
8192 default as that is what we should be optimizing for.

Fixes: https://github.com/nodejs/node/issues/31022

PR-URL: https://github.com/nodejs/node/pull/36794
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
2021-01-06 21:18:47 -08:00
Andrey Pechkurov
860c18be87 benchmark: add simple https benchmark
Adds a simple benchmark for https server based on the http simple
benchmark. Updates benchmarker integration for autocannon and wrk,
so that they support https scheme.

Also adds a new HTTPS section and improves HTTP/2 section in
the benchmark guide.

PR-URL: https://github.com/nodejs/node/pull/36612
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2020-12-25 18:11:44 +00:00
Momtchil Momtchev
656ce920a3 errors: eliminate all overhead for hidden calls
Eliminate all overhead for function calls that are to be
hidden from the stack traces at the expense of
reduced performance for the error case

Fixes: https://github.com/nodejs/node/issues/35386

PR-URL: https://github.com/nodejs/node/pull/35644
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2020-12-22 11:09:55 +01:00
Rich Trott
fee3b89a2b
benchmark: reduce code duplication
Merge duplicate case code in child-process-params.js.

PR-URL: https://github.com/nodejs/node/pull/36568
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-12-21 13:43:30 +01:00
Michaël Zasso
bf31d3c3b1
tools: enable no-unused-expressions lint rule
Fixes: https://github.com/nodejs/node/issues/36246

PR-URL: https://github.com/nodejs/node/pull/36248
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-12-07 20:33:45 +01:00
Antoine du Hamel
99f61677a9 benchmark,child_process: remove failing benchmark parameter
A 16 MiB strings seems to be too large to be send to the parent process,
making the whole benchmark throws.

PR-URL: https://github.com/nodejs/node/pull/36295
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2020-12-02 20:33:34 +00:00
Narasimha Prasanna HN
49abda71e2 benchmark : changed fstat to fstatSync
PR-URL: https://github.com/nodejs/node/pull/36206
Fixes: https://github.com/nodejs/node/issues/36199
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-11-26 07:28:59 +00:00
Gabriel Schulhof
39e4d82c70 benchmark: fix build warnings
The napi/* benchmarks were using an incorrect signature for the V8
add-on init function. This was causing a warning.

Signed-off-by: Gabriel Schulhof <gabriel.schulhof@intel.com>
PR-URL: https://github.com/nodejs/node/pull/36157
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
2020-11-19 19:01:38 -08:00
Andrew Casey
3772cf56ae
lib: add throws option to fs.f/l/statSync
For consumers that aren't interested in *why* a `statSync` call failed,
allocating and throwing an exception is an unnecessary expense.  This PR
adds an option that will cause it to return `undefined` in such cases
instead.

As a motivating example, the JavaScript & TypeScript language service
shared between Visual Studio and Visual Studio Code is stuck with
synchronous file IO for architectural and backward-compatibility
reasons.  It frequently needs to speculatively check for the existence
of files and directories that may not exist (and cares about file vs
directory, so `existsSync` is insufficient), but ignores file system
entries it can't access, regardless of the reason.

Benchmarking the language service is difficult because it's so hard to
get good coverage of both code bases and user behaviors, but, as a
representative metric, we measured batch compilation of a few hundred
popular projects (by star count) from GitHub and found that, on average,
we saved about 1-2% of total compilation time.  We speculate that the
savings could be even more significant in interactive (language service
or watch mode) scenarios, where the same (non-existent) files need to be
polled over and over again.  It's not a huge improvement, but it's a
very small change and it will affect a lot of users (and CI runs).

For reference, our measurements were against `v12.x` (3637a061a at the
time) on an Ubuntu Server desktop with an SSD.

PR-URL: https://github.com/nodejs/node/pull/33716
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2020-11-18 16:19:33 -05:00
Richard Lau
85b42af439 benchmark: ignore build artifacts for napi addons
Add `.gitignore` to ignore the `build` directory in a similar way
to the other addons under `benchmark/napi`.

PR-URL: https://github.com/nodejs/node/pull/35970
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-11-07 02:57:54 +00:00
Richard Lau
540b79605b benchmark: remove modules that require intl
`inspector` and `trace_events` will throw errors if Node.js has been
compiled with `--without-intl`.

Refs: https://github.com/nodejs/node/pull/35816

PR-URL: https://github.com/nodejs/node/pull/35968
Fixes: https://github.com/nodejs/node/issues/35962
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Harshitha K P <harshitha014@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
2020-11-05 07:23:47 +00:00
Joyee Cheung
dbcadf005e
benchmark: make the benchmark tool work with Node 10
Avoid using class fields in the benchmark tools since they are
not available in Node 10. This can be reverted when Node 10
reaches EOL.

PR-URL: https://github.com/nodejs/node/pull/35817
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Mary Marchini <oss@mmarchini.me>
2020-11-04 10:40:14 +08:00
Joyee Cheung
38c15691eb
benchmark: add startup benchmark for loading public modules
Adding a new benchmark for testing the performance of loading
available public modules.

PR-URL: https://github.com/nodejs/node/pull/35816
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-11-04 10:39:13 +08:00
Stephen Belanger
7231b5139e http: report request start and end with diagnostics_channel
PR-URL: https://github.com/nodejs/node/pull/34895
Reviewed-By: Bryan English <bryan@bryanenglish.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2020-10-31 21:24:12 +00:00
Stephen Belanger
c6c36c3da7 lib: create diagnostics_channel module
PR-URL: https://github.com/nodejs/node/pull/34895
Reviewed-By: Bryan English <bryan@bryanenglish.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2020-10-31 21:24:11 +00:00
Andrey Pechkurov
761c1b0797 tls: allow reading data into a static buffer
Refs: #25436

PR-URL: https://github.com/nodejs/node/pull/35753
Refs: https://github.com/nodejs/node/pull/25436
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
2020-10-28 16:07:29 +03:00
Trevor Norris
04d16646a0 worker: add eventLoopUtilization()
Allow calling eventLoopUtilization() directly on a worker thread:

    const worker = new Worker('./foo.js');
    const elu = worker.performance.eventLoopUtilization();
    setTimeout(() => {
      worker.performance.eventLoopUtilization(elu);
    }, 10);

Add a new performance object on the Worker instance that will hopefully
one day hold all the other performance metrics, such as nodeTiming.

Include benchmarks and tests.

PR-URL: https://github.com/nodejs/node/pull/35664
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-10-27 09:43:20 +01:00
Guy Bedford
f3ce2811dd module: use Wasm CJS lexer when available
PR-URL: https://github.com/nodejs/node/pull/35583
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
2020-10-12 04:24:41 -07:00
James M Snell
dae283d96f
crypto: refactoring internals, add WebCrypto
Fixes: https://github.com/nodejs/node/issues/678
Refs: https://github.com/nodejs/node/issues/26854

Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/35093
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-10-07 17:27:05 -07:00
Trevor Norris
589b2a1244 perf_hooks: add idleTime and event loop util
Use uv_metrics_idle_time() to return a high resolution millisecond timer
of the amount of time the event loop has been idle since it was
initialized.

Include performance.eventLoopUtilization() API to handle the math of
calculating the idle and active times. This has been added to prevent
accidental miscalculations of the event loop utilization. Such as not
taking into consideration offsetting nodeTiming.loopStart or timing
differences when being called from a Worker thread.

PR-URL: https://github.com/nodejs/node/pull/34938
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Adrian Estrada <edsadr@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
2020-08-29 07:02:31 -07:00
Yash Ladha
56b25e7a6f benchmark: add benchmark script for resourceUsage
Added a benchmark script for process method to benchmark the method
resourceUsage.

PR-URL: https://github.com/nodejs/node/pull/34691
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Mary Marchini <oss@mmarchini.me>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ricky Zhou <0x19951125@gmail.com>
2020-08-13 22:33:07 +08:00
Anna Henningsen
9dac8cbbc3 benchmark: update function_args addon code
Make the code linter-conformant and remove usage of deprecated APIs.

PR-URL: https://github.com/nodejs/node/pull/34725
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-08-11 13:29:14 -07:00
Gabriel Schulhof
cc7ec889e8 n-api: support type-tagging objects
`napi_instanceof()` is insufficient for reliably establishing the data
type to which a pointer stored with `napi_wrap()` or
`napi_create_external()` inside a JavaScript object points. Thus, we
need a way to "mark" an object with a value that, when later retrieved,
can unambiguously tell us whether it is safe to cast the pointer stored
inside it to a certain structure.

Such a check must survive loading/unloading/multiple instances of an
addon, so we use UUIDs chosen *a priori*.

Fixes: https://github.com/nodejs/node/issues/28164
Co-authored-by: Anna Henningsen <github@addaleax.net>
PR-URL: https://github.com/nodejs/node/pull/28237
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Signed-off-by: Gabriel Schulhof <gabriel.schulhof@intel.com>
2020-07-31 18:30:30 -07:00