FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

http: make http.OutgoingMessage inherit Stream.Writable by rexagod · Pull Request #33870 · nodejs/node · GitHub

/ node Public

http: make http.OutgoingMessage inherit Stream.Writable - #33870

Closed
rexagod wants to merge 1 commit into
nodejs:masterfrom
rexagod:OutgoingMessage-instanceof-Writable
Closed

http: make http.OutgoingMessage inherit Stream.Writable#33870
rexagod wants to merge 1 commit into
nodejs:masterfrom
rexagod:OutgoingMessage-instanceof-Writable

Conversation

rexagod commented Jun 14, 2020
edited
Loading

Copy link
Copy Markdown
Member

Fixes: #28971

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

nodejs-github-bot added the http Issues and PRs related to the http subsystem. label Jun 14, 2020

rexagod commented Jun 14, 2020
edited
Loading

Copy link
Copy Markdown
Member Author

After these changes, properties that are present:

  • Only on Writable.prototype:
[
  '_destroy',
  '_undestroy',
  '_write',
  '_writev',
  'setDefaultEncoding',
  'writableBuffer'
]
  • Only on OutgoingMessage.prototype:
[
  '_finish',        '_flush',
  '_flushOutput',   '_headerNames',
  '_headers',       '_implicitHeader',
  '_renderHeaders', '_send',
  '_storeHeader',   '_writeRaw',
  'addTrailers',    'connection',
  'flushHeaders',   'getHeader',
  'getHeaderNames', 'getHeaders',
  'hasHeader',      'headersSent',
  'removeHeader',   'setHeader',
  'setTimeout'
]
  • Common to both of their prototypes (and overridden by Outgoing.prototype):
[
  'constructor',
  'cork',
  'destroy',
  'destroyed',
  'end',
  'pipe',
  'uncork',
  'writable',
  'writableCorked',
  'writableEnded',
  'writableFinished',
  'writableHighWaterMark',
  'writableLength',
  'writableObjectMode',
  'write'
]

rexagod commented Jun 14, 2020

Copy link
Copy Markdown
Member Author

ping @mcollina @ronag

ronag left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

The reason we don't inherit Writable is due to performance reasons. It adds too much overhead.

I've been working on a way to get around that but it's not finished yet. #33515

Copy link
Copy Markdown
Member

Have you benchmarked this change? Last time I tried this it slowed things down and it was not really feasible.

rexagod commented Jun 15, 2020

Copy link
Copy Markdown
Member Author

I see. I tried benchmarking this for create-clientrequest.js and results show a negative improvement on performance. #33515 looks interesting, and I reckon it will allow us to successfully inherit and avoid performance degradation once it's done.

                                                           confidence improvement accuracy (*)   (**)  (***)
 http/create-clientrequest.js e=1 arg='options' url='idn'                 -1.99 %       ±5.13% ±6.84% ±8.92%
 http/create-clientrequest.js e=1 arg='options' url='long'                -2.35 %       ±3.10% ±4.13% ±5.38%
 http/create-clientrequest.js e=1 arg='options' url='wpt'                 -2.48 %       ±5.00% ±6.65% ±8.67%
 http/create-clientrequest.js e=1 arg='string' url='idn'                  -1.64 %       ±2.22% ±2.97% ±3.89%
 http/create-clientrequest.js e=1 arg='string' url='long'                 -1.15 %       ±1.47% ±1.96% ±2.56%
 http/create-clientrequest.js e=1 arg='string' url='wpt'                  -0.34 %       ±2.20% ±2.93% ±3.82%
 http/create-clientrequest.js e=1 arg='URL' url='idn'                     -1.03 %       ±2.03% ±2.70% ±3.52%
 http/create-clientrequest.js e=1 arg='URL' url='long'             **     -6.56 %       ±4.28% ±5.75% ±7.60%
 http/create-clientrequest.js e=1 arg='URL' url='wpt'                      1.99 %       ±3.57% ±4.77% ±6.27%

In the meantime, I'll find some more issues to dig in. Feel free to close this one. :)

mcollina closed this Jun 16, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

http Issues and PRs related to the http subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

http: OutgoingMessage instanceof Writable

4 participants


Back | FazBrowse Home | New Git URL