0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-29 23:16:30 +01:00
Commit Graph

480 Commits

Author SHA1 Message Date
Rich Trott
496f60489d tools,benchmark: use stricter indentation linting
Enable stricter indentation rules for benchmark code.

PR-URL: https://github.com/nodejs/node/pull/13895
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2017-06-27 06:17:06 -07:00
Rich Trott
095c0de94d benchmark,lib,test: use braces for multiline block
For if/else and loops where the bodies span more than one line, use
curly braces.

PR-URL: https://github.com/nodejs/node/pull/13828
Ref: https://github.com/nodejs/node/pull/13623#discussion_r123048602
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-06-23 14:43:20 -07:00
Vse Mozhet Byt
b9457717ca benchmark: remove needless RegExp capturing
Use non-capturing grouping or remove capturing completely when:

* capturing is useless per se, e.g. in test() check;
* captured groups are not used afterwards at all;
* some of the later captured groups are not used afterwards.

PR-URL: https://github.com/nodejs/node/pull/13718
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-06-19 18:06:17 +03:00
Brian White
460ee75f7e
process: improve nextTick() performance
PR-URL: https://github.com/nodejs/node/pull/13446
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
2017-06-17 10:38:24 -04:00
Brian White
add4b0ab8c zlib: improve performance
PR-URL: https://github.com/nodejs/node/pull/13322
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2017-06-13 11:48:59 -07:00
Brian White
e5dc934ef6 stream: improve Transform performance
PR-URL: https://github.com/nodejs/node/pull/13322
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2017-06-13 11:48:53 -07:00
Brian White
c4fc7d90ed
http: always cork outgoing writes
PR-URL: https://github.com/nodejs/node/pull/13522
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
2017-06-12 20:42:46 -04:00
Vse Mozhet Byt
8beff64851 benchmark: fix some RegExp nits
* Take RegExp creation out of cycle.
* use test(), not match() in boolean context.

PR-URL: https://github.com/nodejs/node/pull/13551
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-06-12 12:10:22 +03:00
Brian White
8208fdae2b
child_process: reduce nextTick() usage
PR-URL: https://github.com/nodejs/node/pull/13459
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2017-06-09 01:38:58 -04:00
Refael Ackermann
8d2bd5fa88 test,benchmark: stabilize child-process
also some cleanup

PR-URL: https://github.com/nodejs/node/pull/13457
Refs: https://github.com/nodejs/node/issues/12817
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2017-06-07 16:27:00 -04:00
Brian White
656bb71867
dns: improve callback performance
It appears that either c-ares no longer calls callbacks synchronously
or we have since explicitly taken care of the scenarios in which
c-ares would call callbacks synchronously (e.g. resolving an IP
address or an empty hostname). Therefore we no longer need to have
machinery in place to handle possible synchronous callback invocation.
This improves performance significantly.

PR-URL: https://github.com/nodejs/node/pull/13261
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-06-01 22:00:50 -04:00
Brian White
359ea2a0bd
stream: improve readable push performance
PR-URL: https://github.com/nodejs/node/pull/13113
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2017-05-23 20:50:22 +02:00
Rich Trott
c3067b5640 benchmark: allow no duration in benchmark tests
Imprecision in process.hrtime() in some situations can result in a zero
duration being used as a denominator in benchmark tests. This would
almost certainly never happen in real benchmarks. It is only likely in
very short benchmarks like the type we run in our test suite to just
make sure that the benchmark code is runnable.

So, if the environment variable that we use in tests to indicate "allow
ludicrously short benchmarks" is set, convert a zero duration for
a benchmark to 1 nano-second.

PR-URL: https://github.com/nodejs/node/pull/13110
Fixes: https://github.com/nodejs/node/issues/13102
Fixes: https://github.com/nodejs/node/issues/12433
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2017-05-21 20:05:13 -07:00
Rich Trott
f2ba06db92 benchmark: remove redundant timers benchmark
The immediate.js benchmark with `type` set to `depth` measures the same
thing as set-immediate-depth.js. Remove the redundancy.`

PR-URL: https://github.com/nodejs/node/pull/13009
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
2017-05-16 21:38:17 -07:00
Gabriel Schulhof
276720921b
addons: remove semicolons from after module definition
Having semicolons there runs counter to our documentation and illicits
warnings in pedantic mode. This removes semicolons from after uses of
NODE_MODULE and NODE_MODULE_CONTEXT_AWARE_BUILTIN.

PR-URL: https://github.com/nodejs/node/pull/12919
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
2017-05-15 20:33:06 +02:00
Joyee Cheung
3fa5d80eda benchmark: chunky http client should exit with 0
Previously when there is an error in the chunky client of the
http benchmark, the server would not check the exit code and
thus produce invalid results.

PR-URL: https://github.com/nodejs/node/pull/12916
Fixes: https://github.com/nodejs/node/issues/12903
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-05-13 23:30:29 +08:00
Rich Trott
a82e0e6f36 benchmark: check for time precision in common.js
Some benchmark tests are failing intermittently, possibly due to
hrtime() imprecision on particular hosts. This change will confirm or
refute that as the root cause the next time the test fails on CI. Either
way, it's a valid check.

PR-URL: https://github.com/nodejs/node/pull/12934
Ref: https://github.com/nodejs/node/issues/12497
Ref: https://github.com/nodejs/node/issues/12433
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-05-11 16:20:19 -07:00
Vse Mozhet Byt
65d6249979 benchmark: update an obsolete path
PR-URL: https://github.com/nodejs/node/pull/12904
Refs: https://github.com/nodejs/node/issues/12903
Refs: https://github.com/nodejs/node/commit/ff001c1
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-05-08 23:19:41 +03:00
Refael Ackermann
68c933c01e test: fix flakyness with yes.exe
PR-URL: https://github.com/nodejs/node/pull/12821
Fixes: https://github.com/nodejs/node/issues/12817
Refs: https://github.com/nodejs/node/pull/12658
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-05-06 08:20:07 -04:00
Rich Trott
ff001c12b0 test: move WPT to its own testing module
This is first in a hoped-for series of moves away from a monolithic
common.js that is loaded for every test and towards a more modular
approach. (In the end, common.js will hopefully contain checks for
variables leaking into the global space and perhaps some of the more
ubiquitous functions like common.mustCall().)

Move the WPT testing code to its own module.

PR-URL: https://github.com/nodejs/node/pull/12736
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2017-05-03 17:00:31 -07:00
Rich Trott
a1a54ca3f1 benchmark: terminate child process on Windows
test-benchmark-child-process failures reveal that
child-process-exec-stdout benchmark sometimes leaves around a stray
yes.exe process. Add code to terminate the process.

PR-URL: https://github.com/nodejs/node/pull/12658
Ref: https://github.com/nodejs/node/issues/12560
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-28 16:18:35 -07:00
James M Snell
1052383f7c v8: refactor struture of v8 module
Use the more efficient module.exports = {} pattern,
restructure imports from bindings, requires.

PR-URL: https://github.com/nodejs/node/pull/12681
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
2017-04-28 14:29:45 -07:00
James M Snell
bed4612c40 benchmark: add benchmark for v8.getHeap*Statistics
PR-URL: https://github.com/nodejs/node/pull/12681
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
2017-04-28 14:29:33 -07:00
Vse Mozhet Byt
d8965d5b0e benchmark: fix typo in _http-benchmarkers.js
PR-URL: https://github.com/nodejs/node/pull/12455
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-20 04:48:05 +03:00
Vse Mozhet Byt
a3778cb9b1 benchmark: fix URL in _http-benchmarkers.js
PR-URL: https://github.com/nodejs/node/pull/12455
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-20 04:47:44 +03:00
Vse Mozhet Byt
3b1e837c27 benchmark: add benchmark for string concatenations
PR-URL: https://github.com/nodejs/node/pull/12455
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-20 04:47:18 +03:00
Vse Mozhet Byt
22aa3d4899 benchmark: reduce string concatenations
PR-URL: https://github.com/nodejs/node/pull/12455
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-20 04:46:37 +03:00
Vse Mozhet Byt
bbbb1f6078 benchmark: fix CLI arguments check in common.js
PR-URL: https://github.com/nodejs/node/pull/12429
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-20 03:34:13 +03:00
Joyee Cheung
3d7c82bd61 test: add test for child_process benchmark
PR-URL: https://github.com/nodejs/node/pull/12326
Ref: https://github.com/nodejs/node/issues/12068
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
2017-04-19 22:58:26 +08:00
James M Snell
0227571c17 Revert "benchmark: fix CLI arguments check in common.js"
This reverts commit e34f8e1444.

PR-URL: https://github.com/nodejs/node/pull/12474
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-04-17 15:50:20 -07:00
Brian White
ccdcd9168a benchmark: improve cli error message
When no matching benchmark files are found, a more sensible error
is shown now.

PR-URL: https://github.com/nodejs/node/pull/12421
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-17 14:48:40 -07:00
Vse Mozhet Byt
e34f8e1444 benchmark: fix CLI arguments check in common.js
PR-URL: https://github.com/nodejs/node/pull/12429
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-17 14:36:36 -07:00
Brian White
e0f0f2664e
buffer: use slightly faster NaN check
PR-URL: https://github.com/nodejs/node/pull/12286
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-04-14 18:01:43 -04:00
Brian White
4749ec2aa3
buffer: optimize write()
PR-URL: https://github.com/nodejs/node/pull/12361
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-04-14 22:36:46 +02:00
Brian White
3ee4a1a281
buffer: optimize toString()
PR-URL: https://github.com/nodejs/node/pull/12361
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-04-14 22:36:42 +02:00
Brian White
4a86803f60
buffer: optimize from() and byteLength()
PR-URL: https://github.com/nodejs/node/pull/12361
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-04-14 22:35:59 +02:00
Refael Ackermann
fbe946bb63 benchmark,windows: TCP.readStart() meaningful only after completion
fixes #11972

PR-URL: https://github.com/nodejs/node/pull/12258
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-14 00:04:27 -04:00
Vse Mozhet Byt
0f69f40af0 benchmark: replace more [].join() with ''.repeat()
Refs: https://github.com/nodejs/node/pull/12170

PR-URL: https://github.com/nodejs/node/pull/12317
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-13 00:31:25 +03:00
Joyee Cheung
3e3414f45f benchmark: control HTTP benchmarks run time
PR-URL: https://github.com/nodejs/node/pull/12121
Refs: https://github.com/nodejs/node/issues/12068
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-09 18:16:08 +08:00
Joyee Cheung
a3e71a8901 benchmark: add test double HTTP benchmarker
Refactor benchmark/_http-benchmarkers.js and add a test double
HTTP benchmarker for testing.

PR-URL: https://github.com/nodejs/node/pull/12121
Refs: https://github.com/nodejs/node/issues/12068
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-09 18:16:03 +08:00
Brian White
b76a350a19 url: avoid instanceof for WHATWG URL
PR-URL: https://github.com/nodejs/node/pull/11690
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
2017-04-04 17:36:37 -07:00
Michaël Zasso
eefdf452c3 benchmark: avoid TurboFan deopt in arrays bench
Something unidentified at the moment is causing the arrays benchmarks to
deopt when run with the TurboFan compiler. Refactor the test to use an
inner function that can be correctly optimized by TurboFan and
Crankshaft.

PR-URL: https://github.com/nodejs/node/pull/11894
Ref: https://github.com/nodejs/node/issues/11851#issuecomment-287106714
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2017-04-04 10:45:43 -07:00
Alexey Orlenko
e77a83f5a5 buffer: optimize decoding wrapped base64 data
The fast base64 decoder used to switch to the slow one permanently when
it saw a whitespace or other garbage character.  Since the most common
situation such characters may be encountered in is line-wrapped base64
data, a more profitable strategy is to decode a single 24-bit group with
the slow decoder and then continue running the fast algorithm.

PR-URL: https://github.com/nodejs/node/pull/12146
Ref: https://github.com/nodejs/node/issues/12114
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-04 09:42:44 -07:00
Vse Mozhet Byt
74dc3bfe08 benchmark: replace [].join() with ''.repeat()
Also add a benchmark to compare both ways to create strings.

PR-URL: https://github.com/nodejs/node/pull/12170
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-04 09:19:18 -07:00
Brian White
61ebfa8d1f tools: add unescaped regexp dot rule to linter
PR-URL: https://github.com/nodejs/node/pull/11834
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
2017-03-29 10:53:28 +02:00
Vse Mozhet Byt
642baf4699 benchmark: check end() argument to be > 0
PR-URL: https://github.com/nodejs/node/pull/12030
Ref: https://github.com/nodejs/node/issues/11972
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2017-03-28 03:18:44 +03:00
Rich Trott
874b6b948c benchmark: update obsolete information pointer
A doc suggested in an error message is no longer the place to get the
information about required http benchmarkers. Update the error message
to point to the current location for the information.

PR-URL: https://github.com/nodejs/node/pull/12026
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
2017-03-26 11:30:29 +02:00
Timothy Gu
a6e69f8c08 benchmark: add more options to map-bench
PR-URL: https://github.com/nodejs/node/pull/11930
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>
2017-03-24 15:25:14 -07:00
Sorin Baltateanu
d9b0e4c729 benchmark: repair the fs/readfile benchmark
PR-URL: https://github.com/nodejs/node/pull/7818
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-03-24 15:21:21 -07:00
Nikolai Vavilov
43fa0a8847 benchmark: allow multiple values for same config
This allows running a benchmark with two or more values for the same
config rather than just one or all of them, for example:

```
node benchmark/buffers/buffer-creation.js type=buffer() type=fast-alloc type=fast-alloc-fill
```

PR-URL: https://github.com/nodejs/node/pull/11819
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2017-03-22 19:41:24 +02:00