GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — dev: merge HTTP chunks during chunked encoding by mertcanaltin · Pull Request #47575 · nodejs/node

Conversation

@mertcanaltin

@mertcanaltin mertcanaltin commented Apr 15, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Use ASCII instead of Latin1 as encoding. ASCII is a subset of Latin1 and provides better compatibility across different systems and platforms @mcollina @ronag #57

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@nodejs-github-bot

nodejs-github-bot commented Apr 15, 2023

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/http
  • @nodejs/net
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot nodejs-github-bot added http Issues and PRs related to the http subsystem. needs-ci PRs that need a full CI run. labels Apr 15, 2023
@mertcanaltin mertcanaltin changed the title dev: merge HTTP chunks during chunked encoding #57 dev: merge HTTP chunks during chunked encoding Apr 15, 2023
@mertcanaltin
lib: merge http chunks during chunked encoding
a48eacd
@mertcanaltin
mertcanaltin force-pushed the dev-57 branch from 3be1daa to a48eacd Compare April 15, 2023 21:26
@mertcanaltin mertcanaltin mentioned this pull request Apr 15, 2023
Merge HTTP chunks during chunked encoding nodejs/performance#57
Closed
@mertcanaltin
blank delete
db90840
mscdex
mscdex reviewed Apr 15, 2023
View reviewed changes
Comment thread lib/_http_outgoing.js
if (msg.chunkedEncoding && chunk.length !== 0) {
len ??= typeof chunk === 'string' ? Buffer.byteLength(chunk, encoding) : chunk.byteLength;
msg._send(NumberPrototypeToString(len, 16), 'latin1', null);
msg._send(NumberPrototypeToString(len, 16), 'ascii', null);

@mscdex mscdex Apr 15, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I think we shouldn't change this as this will incur unnecessary overhead as node has to parse the string to ensure it's valid ASCII (and we know it will already be valid because we're using the built-in Number.prototype.toString()). latin1 doesn't have such overhead since it's a single byte encoding.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mertcanaltin reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@ronag ronag Apr 16, 2023

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I'm confused. ASCI is also single byte

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@ronag ronag Apr 16, 2023

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Where/Why is there an overhead?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@ronag ronag Apr 16, 2023

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Though I do see now that the change is probably unnecessary.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@ronag ronag Apr 16, 2023

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

We are a bit inconsistent when we use ascii and when we use latin1.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@bnoordhuis bnoordhuis Apr 16, 2023

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Where/Why is there an overhead?

With 'ascii' node checks for every byte it's within the range 0-127 inclusive. With 'latin1' there's no such check.

O(n) vs. O(0), basically. :-)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ronag, mcollina, mertcanaltin, and jazelly reacted with thumbs up emoji
All reactions
  • 👍 4 reactions
@ronag

ronag commented Apr 16, 2023

Copy link
Copy Markdown
Member

The name of the PR and commit is misleading

mertcanaltin reacted with eyes emoji
All reactions
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ronag
ronag requested changes Apr 16, 2023
View reviewed changes

@ronag ronag left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Seems latin1 is to be preferred. https://github.com/nodejs/node/pull/47575/files#r1167745549

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mertcanaltin reacted with hooray emoji
All reactions
  • 🎉 1 reaction
@ronag ronag closed this Apr 16, 2023
@mertcanaltin

mertcanaltin commented Apr 16, 2023

Copy link
Copy Markdown
Member Author

thank you for answers

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

@bnoordhuis bnoordhuis bnoordhuis left review comments
@ronag ronag ronag requested changes
+1 more reviewer
@mscdex mscdex mscdex left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

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

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@mertcanaltin @nodejs-github-bot @ronag @mscdex @bnoordhuis
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.