profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/dnlup/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Daniele Belardi dnlup Rome, Italy ...

dnlup/doc 6

Get usage and health data about your Node.js process.

dnlup/fastify-traps 4

A fastify plugin to close the server gracefully on SIGINT and SIGTERM signals

dnlup/agent-11 3

A simple pool manager for undici

dnlup/fastify-doc 1

A Fastify plugin for sampling process metrics.

dnlup/jsdoc-webpack-plugin 1

JsDoc Webpack Plugin

dnlup/active-win 0

Get metadata about the active window (title, id, bounds, owner, etc)

dnlup/autocannon 0

fast HTTP/1.1 benchmarking tool written in Node.js

dnlup/ava 0

Node.js test runner that lets you develop with confidence ๐Ÿš€

dnlup/cloe 0

Configuration loader/validator

dnlup/create-package 0

An npm initializer for a generic Node.js package

pull request commentfastify/fastify

perf: loop optimization

There's some sort of TS error https://github.com/fastify/fastify/pull/2992/checks?check_run_id=2390180915#step:6:10978

Vetlix

comment created time in 5 minutes

issue commentnodejs/node

Why promises.writeFile writeFile writeFileSync (readFile etc) write buffer multi times?

The only place where I could find 8192 related to fs is in the implementation of readFileSync: https://github.com/nodejs/node/blob/a0261d231c4353cbea29d0c747c4e604d3dcb6aa/lib/fs.js#L427-L428 If the file being read from is not a regular file, we arbitrarily create a buffer of size 8192 and read into it. We continue reading and appending the read buffer to an array of buffers while the number of bytes read (returned by tryReadSync) is not 0.

LongTengDao

comment created time in 10 minutes

pull request commentnodejs/node

crypto: fix DiffieHellman generator validation

CI: https://ci.nodejs.org/job/node-test-pull-request/37581/

EladKeyshawn

comment created time in 12 minutes

startedmandarineorg/mandarinets

started time in 12 minutes

pull request commentnodejs/undici

chore: Replace benchmark with cronometro for benchmarking.

Benchmarks updated. We have two different suites now. Let me know if I set everything correct.

ShogunPanda

comment created time in 15 minutes

issue commentnodejs/node

Why promises.writeFile writeFile writeFileSync (readFile etc) write buffer multi times?

Why not write the whole buffer one time?

I think Node.js tries to write the whole buffer, but depending on the host OS/FS/hardware, it might need to write in several bits. How did you come with this 8192 figure?

Won't that be faster in fact?

It certainly would be, but I'm afraid there's nothing we can do at Node.js level.

LongTengDao

comment created time in 23 minutes

pull request commentnodejs/node

tls: validate ticket keys buffer

CI: https://ci.nodejs.org/job/node-test-pull-request/37580/

aduh95

comment created time in 32 minutes

pull request commentnodejs/node

2021-04-20, Version 16.0.0 (Current)

CI: https://ci.nodejs.org/job/node-test-pull-request/37579/

BethGriggs

comment created time in an hour

Pull request review commentnodejs/node

[v14.x backport] doc: update `buffer.constants.MAX_LENGTH`

 added: v8.2.0 #### `buffer.constants.MAX_LENGTH` <!-- YAML added: v8.2.0+changes:+  - version: v14.0.0+    pr-url: https://github.com/nodejs/node/pull/32116+    description: Value is changed from 2<sup>31</sup> - 1 to+      2<sup>32</sup> - 1 on 64-bit architectures. -->  * {integer} The largest size allowed for a single `Buffer` instance.  On 32-bit architectures, this value currently is 2<sup>30</sup> - 1 (~1GB).-On 64-bit architectures, this value currently is 2<sup>31</sup> - 1 (~2GB).++On 64-bit architectures, this value currently is 2<sup>32</sup> (~4GB).

Should I add the -1?

Yes, the correct value is 2**32 - 1 on v14.x.

juanarbol

comment created time in an hour

issue commentnodejs/node

Why promises.writeFile writeFile writeFileSync etc write buffer multi times by 8192 for each time?

Could you provide which code snippet in question?

LongTengDao

comment created time in an hour

Pull request review commentnodejs/node

crypto: add sizeOrKey validation at DiffieHellman constructor

 function DiffieHellman(sizeOrKey, keyEncoding, generator, genEncoding) {   if (typeof sizeOrKey !== 'number')     sizeOrKey = toBuf(sizeOrKey, keyEncoding); -  if (!generator) {

I don't think this is correct, I think you need to do this instead:

diff --git a/lib/internal/crypto/diffiehellman.js b/lib/internal/crypto/diffiehellman.js
index e2106b211ba..19116c97bf8 100644
--- a/lib/internal/crypto/diffiehellman.js
+++ b/lib/internal/crypto/diffiehellman.js
@@ -122,9 +122,9 @@ function DiffieHellman(sizeOrKey, keyEncoding, generator, genEncoding) {
     generator = DH_GENERATOR;
   } else if (typeof generator === 'number') {
     validateInt32(generator, 'generator');
-  } else if (generator !== true) {
+  } else if (typeof generator === 'string') {
     generator = toBuf(generator, genEncoding);
-  } else {
+  } else if(!isArrayBufferView(generator) && !isAnyArrayBuffer(generator)) {
     throw new ERR_INVALID_ARG_TYPE(
       'generator',
       ['number', 'string', 'ArrayBuffer', 'Buffer', 'TypedArray', 'DataView'],
EladKeyshawn

comment created time in an hour

Pull request review commentnodejs/node

crypto: add sizeOrKey validation at DiffieHellman constructor

 for (const bits of [-1, 0, 1]) {   crypto.createDiffieHellman('abcdef', 'hex', g); } +assert.throws(() => crypto.createDiffieHellman('', 'base64', () => {}), {+  code: 'ERR_OSSL_BN_BITS_TOO_SMALL',+  name: 'Error',+  message: /bits too small/,+});+

Can you put this at the end of the file please

[true, Symbol(), {}, () => {}, []].forEach((generator) => assert.throws(
  () => crypto.createDiffieHellman('', 'base64', generator),
  { code: 'ERR_INVALID_ARG_TYPE' }
));
EladKeyshawn

comment created time in an hour

Pull request review commentnodejs/node

dns: allow --dns-order to change default dns verbatim

+// Flags: --expose-internals+'use strict';+const common = require('../common');+const assert = require('assert');+const { internalBinding } = require('internal/test/binding');+const cares = internalBinding('cares_wrap');+const { promisify } = require('util');++// Test that changing require('dns').verbatim works as expected.++const originalGetaddrinfo = cares.getaddrinfo;+const calls = [];+cares.getaddrinfo = common.mustCallAtLeast((...args) => {+  calls.push(args);+  originalGetaddrinfo(...args);+}, 1);++const dns = require('dns');+const dnsPromises = dns.promises;++let verbatim;++// We want to test the parameter of verbatim only so that we+// ignore possible errors here.+function allowFailed(fn) {+  return fn.catch((_err) => {+    //+  });+}++(async () => {+  let callsLength = 0;+  const checkParameter = (expected) => {+    assert.strictEqual(calls.length, callsLength + 1);+    verbatim = calls[callsLength][4];+    assert.strictEqual(verbatim, expected);+    callsLength += 1;+  };++  dns.verbatim = true;

Yes, they are different types(or they are not consistent enough).

Perhaps instead of the boolean flag here it should use the same values as the command line arg?

I guess I should have kept this as simple as a boolean value which only focuses on the parameter of verbatim.

oyyd

comment created time in an hour

pull request commentnodejs/undici

chore: Replace benchmark with cronometro for benchmarking.

Is it possible to skip the grouping headers? The fastest test is always in the bottom so it's just noise, no?

Unfortunately not, that's fixed in cronometro.

I'll update benchmarks soon.

ShogunPanda

comment created time in an hour

pull request commentnodejs/node

tls: fix tlsSocket.setMaxSendFragment results in an abort

@benjamingr Hey is this waiting for something?

EladKeyshawn

comment created time in an hour

PR opened nodejs/node

src: Use %progbits instead of @progbits

While @progbits is preferred for most architectures, there are some (notably 32-bit ARM) for which it does not. %progbits is effective everywhere.

See https://bugzilla.redhat.com/show_bug.cgi?id=1950528 for more details.

Related: https://github.com/nodejs/node/issues/17933 Related: https://github.com/nodejs/node/pull/37688

Signed-off-by: Stephen Gallagher sgallagh@redhat.com

Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or

(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or

(c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.

(d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved.

+1 -1

0 comment

1 changed file

pr created time in an hour

pull request commentnodejs/undici

chore: Replace benchmark with cronometro for benchmarking.

Is it possible to skip the grouping headers? The fastest test is always in the bottom so it's just noise, no?

ShogunPanda

comment created time in 2 hours

Pull request review commentnodejs/node

crypto: add sizeOrKey validation at DiffieHellman constructor

 function DiffieHellman(sizeOrKey, keyEncoding, generator, genEncoding) {   if (typeof sizeOrKey !== 'number')     sizeOrKey = toBuf(sizeOrKey, keyEncoding); -  if (!generator) {

I'm still not sure what should be the behaviour of this when generator is function

EladKeyshawn

comment created time in 2 hours

Pull request review commentnodejs/undici

chore: Replace benchmark with cronometro for benchmarking.

 class SimpleRequest {     throw err   } }++function makeParallelRequests (cb) {+  return Promise.all(Array.from(Array(parallelRequests)).map(() => new Promise(cb)))+}++cronometro(+  {+    'http - no agent' () {+      return makeParallelRequests(resolve => {+        http.get(httpNoAgent, res => {
        http.get(httpNoKeepAlive, res => {

Make an agent that has the maxSockets options but keepAlive: false

ShogunPanda

comment created time in 2 hours

Pull request review commentnodejs/undici

chore: Replace benchmark with cronometro for benchmarking.

 class SimpleRequest {     throw err   } }++function makeParallelRequests (cb) {+  return Promise.all(Array.from(Array(parallelRequests)).map(() => new Promise(cb)))+}++cronometro(+  {+    'http - no agent' () {
    'http - no keepalive - multiple sockets' () {
ShogunPanda

comment created time in 2 hours

pull request commentnodejs/undici

chore: Replace benchmark with cronometro for benchmarking.

@ShogunPanda can we split the benchmarks into multi socket and single socket ones? That way the relative values make more sense.

ShogunPanda

comment created time in 2 hours

pull request commentnodejs/undici

chore: Replace benchmark with cronometro for benchmarking.

It's a bit weird that http - keepalive is slowest?

That option uses 1 socket if I am not mistaken, so I suspect that requests are run sequentially in that case.

Yea, I think it's the no agent case which is misleading.

ShogunPanda

comment created time in 2 hours

pull request commentnodejs/undici

chore: Replace benchmark with cronometro for benchmarking.

Maybe http - no agent should be called http - no agent - multiple sockts?

ShogunPanda

comment created time in 2 hours

pull request commentnodejs/undici

chore: Replace benchmark with cronometro for benchmarking.

Cronometro runs with "warmup" mode by default. For each test, it executes twice, the first time discarding results. Tests are run in series and each is run in a separate worker thread so no interaction should be possible.

Here's my results:

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•คโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•คโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•คโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•คโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘ Slower tests                               โ”‚ Samples โ”‚        Result โ”‚ Tolerance โ”‚ Difference with slowest โ•‘
โ•Ÿโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ข
โ•‘ http - keepalive                           โ”‚     100 โ”‚  61.35 op/sec โ”‚  ยฑ 1.08 % โ”‚                         โ•‘
โ•‘ http - no agent                            โ”‚     100 โ”‚ 201.87 op/sec โ”‚  ยฑ 2.03 % โ”‚ + 229.03 %              โ•‘
โ•‘ http - keepalive - multiple sockets        โ”‚     100 โ”‚ 302.28 op/sec โ”‚  ยฑ 1.92 % โ”‚ + 392.69 %              โ•‘
โ•‘ undici - pipeline                          โ”‚     100 โ”‚ 377.43 op/sec โ”‚  ยฑ 2.33 % โ”‚ + 515.18 %              โ•‘
โ•‘ undici - pool - request - multiple sockets โ”‚     100 โ”‚ 392.54 op/sec โ”‚  ยฑ 1.99 % โ”‚ + 539.80 %              โ•‘
โ•‘ undici - request                           โ”‚     100 โ”‚ 395.92 op/sec โ”‚  ยฑ 1.97 % โ”‚ + 545.32 %              โ•‘
โ•‘ undici - stream                            โ”‚     100 โ”‚ 421.28 op/sec โ”‚  ยฑ 1.91 % โ”‚ + 586.65 %              โ•‘
โ•‘ undici - dispatch                          โ”‚     100 โ”‚ 426.49 op/sec โ”‚  ยฑ 1.89 % โ”‚ + 595.14 %              โ•‘
โ•Ÿโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ข
โ•‘ Fastest test                               โ”‚ Samples โ”‚        Result โ”‚ Tolerance โ”‚ Difference with slowest โ•‘
โ•Ÿโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ข
โ•‘ undici - noop                              โ”‚     100 โ”‚ 538.81 op/sec โ”‚  ยฑ 1.81 % โ”‚ + 778.21 %              โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•งโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•งโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•งโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•งโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
ShogunPanda

comment created time in 2 hours

pull request commentnodejs/undici

chore: Replace benchmark with cronometro for benchmarking.

Also the multiple socket results seem weird. Maybe they always have. Do we need those? @mcollina

ShogunPanda

comment created time in 2 hours

pull request commentnodejs/undici

chore: Replace benchmark with cronometro for benchmarking.

What results do you get if you run it locally? Also what order are they run in? Could it be some kind of warm up thing? Should we run each test in a separate node instance?

ShogunPanda

comment created time in 2 hours

issue closedfastify/fastify

issue with bcrypt in fasitify

<!-- Before you submit an issue we recommend you visit Fastify Help and ask any questions you have or mention any problems you've had getting started with Fastify.

Please read this entire template before posting any issue. If you ignore these instructions and post an issue here that does not follow the instructions, your issue might be closed, locked, and assigned the missing discussion label. -->

๐Ÿ› Bug Report

while using bcrypt in fastify. it is taking too much time to encrypt password in async. if i am not using async await then it's throw err and error is written below

FST_ERR_PROMISE_NOT_FULFILLED","statusCode":500},"msg":"Promise may not be fulfilled with 'undefined' when statusCode is not 204

closed time in 2 hours

Adityapanther

issue commentfastify/fastify

issue with bcrypt in fasitify

it's working fine, thanks guys.

Adityapanther

comment created time in 2 hours

pull request commentnodejs/node

crypto: add sizeOrKey validation at DiffieHellman constructor

I had a mistake at the actual problem I had to fix, fixing it now...

EladKeyshawn

comment created time in 2 hours

pull request commentnodejs/undici

chore: Replace benchmark with cronometro for benchmarking.

To be honest I have no idea. I've checked the code and everything seems to be fine. I wonder if the socket buffers are filled up and thus performance decrease.

ShogunPanda

comment created time in 2 hours