GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||
GeezerVison is showing github.com — dev: merge HTTP chunks during chunked encoding by mertcanaltin · Pull Request #47575 · nodejs/node Conversation
|
|
Review requested:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| 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); |
There was an error while loading. Please reload this page.
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem 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.
There was an error while loading. Please reload this page.
|
The name of the PR and commit is misleading |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem 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.
There was an error while loading. Please reload this page.
|
thank you for answers |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.