Skip to content

Conversation

@Ayoub-Mabrouk
Copy link

Use object destructuring with numeric keys to directly extract
options and callback from net._normalizeArgs() result, eliminating
the intermediate normalized variable.

Use object destructuring with numeric keys to directly extract
options and callback from net._normalizeArgs() result, eliminating
the intermediate normalized variable.
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/http
  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added http Issues or PRs related to the http subsystem. needs-ci PRs that need a full CI run. labels Oct 22, 2025
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect this would incur in some overhead, so I would prefer not to change this.

@Ayoub-Mabrouk
Copy link
Author

I suspect this would incur in some overhead, so I would prefer not to change this.

Thanks for the feedback!
From what I understand, destructuring with numeric keys ({ 0: x, 1: y }) is compiled down to the same property access as array[0] and array[1], and is inlined by modern JIT engines like V8.
There shouldn’t be any measurable runtime overhead, it’s mainly a stylistic change for conciseness.
That said, I’m fine reverting if we prefer to stick with explicit indexing for clarity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

http Issues or PRs related to the http subsystem. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants