Commit Graph

19 Commits

Author SHA1 Message Date
Antoine du Hamel
ca5f322d32
benchmark: add trailing commas
PR-URL: https://github.com/nodejs/node/pull/46370
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: James M Snell <jasnell@gmail.com>
2023-01-29 19:13:35 +01:00
dnlup
57a1ca99ab benchmark: use let instead of var in dgram
PR-URL: https://github.com/nodejs/node/pull/31175
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
2020-01-05 19:30:33 -08:00
Anna Henningsen
afdc3d0d18 dgram: use uv_udp_try_send()
This improves dgram performance by avoiding unnecessary async
operations.

One issue with this commit is that it seems hard to actually create
conditions under which the fallback path to the async case is
actually taken, for all supported OS, so an internal CLI option
is used for testing that path.

Another caveat is that the lack of an async operation means
that there are slight timing differences (essentially `nextTick()`
rather than `setImmediate()` for the send callback).

PR-URL: https://github.com/nodejs/node/pull/29832
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2019-10-05 17:48:10 -07:00
Rich Trott
29e74d4952 benchmark: refactor for consistent style
Code in benchmark directory sometimes uses `function () {}` for
anonymous callbacks and sometimes uses `() => {}`. Multi-line arrays
sometimes have a trailing comma and sometimes do not. Update to always
use arrow functions for anonymous callbacks and trailing commas for
multiline arrays.

PR-URL: https://github.com/nodejs/node/pull/25944
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-06 22:18:31 -08:00
Ruben Bridgewater
1f85ea979c
tools: capitalize sentences
This adds the `capitalized-comments` eslint rule to verify that
actual sentences use capital letters as starting letters. It ignores
special words and all lines below 62 characters.

PR-URL: https://github.com/nodejs/node/pull/24808
Reviewed-By: Sam Ruby <rubys@intertwingly.net>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2018-12-10 17:07:18 +01:00
Ruben Bridgewater
1b6cb94761
benchmark: refactor
PR-URL: https://github.com/nodejs/node/pull/18320
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-02-01 10:49:04 +01:00
Ruben Bridgewater
b2966043c9
benchmark: (dgram) use destructuring
PR-URL: https://github.com/nodejs/node/pull/18250
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-01-23 01:29:33 +01:00
Ruben Bridgewater
e167ab71fb
benchmark: var to const
PR-URL: https://github.com/nodejs/node/pull/13757
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2017-09-19 21:14:38 -03:00
Rich Trott
fffc84a417 benchmark: fix dgram/bind-params.js benchmark
`benchmark/dgram/bind-params` exits with an error frequently in its
current form because no error handler is applied. Add no-op error
handlers to avoid the problem.

```console
$ node benchmark/run.js --filter bind-params dgram

dgram/bind-params.js
dgram/bind-params.js address="true" port="true" n=10000:
193,347.42178656923
events.js:182
      throw er; // Unhandled 'error' event
      ^

Error: bind ENFILE 0.0.0.0
    at Object._errnoException (util.js:1041:11)
    at _exceptionWithHostPort (util.js:1064:20)
    at _handle.lookup (dgram.js:242:18)
    at _combinedTickCallback (internal/process/next_tick.js:141:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
    at Function.Module.runMain (module.js:611:11)
    at startup (bootstrap_node.js:158:16)
    at bootstrap_node.js:598:3
$
```

PR-URL: https://github.com/nodejs/node/pull/14948
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-08-23 22:34:59 -07:00
Abhishek Raj
36817f7f18 benchmark: removed unused arguments from callbacks
Removed unused arguments 'buf' and 'rinfo' from the callbacks.

PR-URL: https://github.com/nodejs/node/pull/14919
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2017-08-21 14:57:44 -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
Anna Henningsen
049709b07d
benchmark: strip BOM in dgram/bind-params
PR-URL: https://github.com/nodejs/node/pull/11479
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-02-24 01:54:45 +01:00
Vse Mozhet Byt
1162e284ca
benchmark: add dgram bind(+/- params) benchmark
Refs: https://github.com/nodejs/node/pull/11242
PR-URL: https://github.com/nodejs/node/pull/11313
Reviewed-By: Brian White <mscdex@mscdex.net>
2017-02-21 18:27:11 +01:00
Rich Trott
ae25ed3ccd benchmark: favor === over ==
Refs: https://github.com/nodejs/node/pull/7961#discussion_r73788501
PR-URL: https://github.com/nodejs/node/pull/8000
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
2016-08-09 14:40:01 -07:00
Andreas Madsen
8bb59fdb12 benchmark: missing process.exit after bench.end
Previously bench.end would call process.exit(0) however this is rather
confusing and indeed a few benchmarks had code that assumed otherwise.

This adds process.exit(0) to the benchmarks that needs it.

PR-URL: https://github.com/nodejs/node/pull/7094
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-07-26 13:21:50 +02:00
Rich Trott
ce9456d690 benchmark: remove unused variables
Remove variables that are assigned but never used.

(This was missed by the linter in previous versions of ESLint but is
flagged by the current version. Updating the linter is contingent on
this change or some similar remedy landing.)

PR-URL: https://github.com/nodejs/node/pull/7600
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2016-07-10 20:13:14 -07:00
James M Snell
85ab4a5f12 buffer: add .from(), .alloc() and .allocUnsafe()
Several changes:

* Soft-Deprecate Buffer() constructors
* Add `Buffer.from()`, `Buffer.alloc()`, and `Buffer.allocUnsafe()`
* Add `--zero-fill-buffers` command line option
* Add byteOffset and length to `new Buffer(arrayBuffer)` constructor
* buffer.fill('') previously had no effect, now zero-fills
* Update the docs

PR-URL: https://github.com/nodejs/node/pull/4682
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
2016-03-16 08:34:02 -07:00
Rich Trott
dcfda1007b tools,benchmark: increase lint compliance
In the hopes of soon having the benchmark code linted, this change
groups all the likely non-controversial lint-compliance changes such as
indentation, semi-colon usage, and single-vs.-double quotation marks.

Other lint rules may have subtle performance implications in the V8
currently shipped with Node.js. Those changes will require more careful
review and will be in a separate change.

PR-URL: https://github.com/nodejs/node/pull/5429
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-02-27 20:15:17 -08:00
Matteo Collina
137f53c7b7 dgram: support dgram.send with multiple buffers
Added ability to dgram.send to send multiple buffers, _writev style.
The offset and length parameters in dgram.send are now optional.
Refactored the dgram benchmarks, and seperated them from net.
Added docs for the new signature.

Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Fixes: https://github.com/nodejs/node/issues/4302
PR-URL: https://github.com/nodejs/node/pull/4374
2016-01-29 19:26:44 +01:00