Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http_outgoing: refactor to use stream.Writable #6085

Closed
wants to merge 3 commits into from

Conversation

indutny
Copy link
Member

@indutny indutny commented Apr 6, 2016

Checklist
  • tests and code linting passes
  • the commit message follows commit guidelines
Affected core subsystem(s)

http

Description of change

Use stream.Writable instead of the piles of suspicious methods on the
top of the legacy Stream.

Additionally, make res.write() return the same value as regular
stream.Writable#write would do after res.end() call. Returning
true is considered a blasphemy from now on, and should be prosecuted
with all possible strictness.

@indutny
Copy link
Member Author

indutny commented Apr 6, 2016

cc @nodejs/http will also fix _send('') hacks that we had all over the place.

cc @trevnorris not sure how fast it is 😢 . Perhaps you could help us?

@indutny
Copy link
Member Author

indutny commented Apr 6, 2016

and cc @bnoordhuis because you are always upset at my patches

@indutny indutny added http Issues or PRs related to the http subsystem. semver-major PRs that contain breaking changes and should be released in the next major version. labels Apr 6, 2016
@indutny
Copy link
Member Author

indutny commented Apr 6, 2016

I have added semver-major label to this PR, however I don't think that it should go into v6. I would give it a try in master though, and, perhaps, several minor releases of v7 before moving it to the next LTS

@@ -42,8 +42,7 @@ server.listen(common.PORT, function() {
break;
}

assert.equal(req.output.length, 0);
assert.equal(req.outputEncodings.length, 0);
assert.equal(req._writableState.length, 0);
Copy link
Member Author

Choose a reason for hiding this comment

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

No more .output and .outputEncodings

@indutny
Copy link
Member Author

indutny commented Apr 6, 2016

@indutny
Copy link
Member Author

indutny commented Apr 11, 2016

@indutny
Copy link
Member Author

indutny commented Apr 11, 2016

@indutny
Copy link
Member Author

indutny commented Apr 11, 2016

Gosh, looks like this patch needs some serious performance improvements. Will see what I can do about it.

Use `stream.Writable` instead of the piles of suspicious methods on the
top of the legacy `Stream`.

Additionally, make `res.write()` return the same value as regular
`stream.Writable#write` would do after `res.end()` call. Returning
`true` is considered a blasphemy from now on, and should be prosecuted
with all possible strictness.
this.socket.destroy(error);
else
this.once('socket', function(socket) {
const socket = this.socket;
Copy link
Contributor

Choose a reason for hiding this comment

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

In my experience (which may be outdated) this provides no (performance) benefit, nor do you explicitly need it here.

Copy link
Member Author

Choose a reason for hiding this comment

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

The only benefit that I thought about is character count :) There are at least four occurrences of socket down there.

Copy link
Member Author

Choose a reason for hiding this comment

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

There may be performance difference, though, but in this particular function it is definitely neglectable.

Copy link
Contributor

@ronkorving ronkorving May 19, 2016

Choose a reason for hiding this comment

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

Yeah, I don't think perf impact would be negative. Just thought you may be trying to optimize for speed here. Carry on :)

@indutny
Copy link
Member Author

indutny commented May 19, 2016

@ronkorving thank you so much for reviewing this! I just wanted to let you know that this PR is in unfinished state, so please be aware that many things may change.

I still need to optimize it performance-wise to make it as fast as the current version (if it is possible at all).

@ronkorving
Copy link
Contributor

No problem, I'm just going through some PRs that seem to be in limbo or in-progress and provide the feedback I can :) Good luck.

@rvagg rvagg force-pushed the master branch 2 times, most recently from c133999 to 83c7a88 Compare October 18, 2016 17:01
@jasnell jasnell added the stalled Issues and PRs that are stalled. label Mar 1, 2017
@fhinkel fhinkel added the wip Issues and PRs that are still a work in progress. label Mar 26, 2017
@fhinkel fhinkel removed the stalled Issues and PRs that are stalled. label Mar 26, 2017
@mscdex
Copy link
Contributor

mscdex commented May 11, 2017

@fhinkel Is this really in progress?

@indutny Rebase is needed

@BridgeAR
Copy link
Member

There was no update for a long while, closing this therefore. @indutny please just reopen if you want to continue working on it.

@jasnell jasnell closed this Aug 29, 2017
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. semver-major PRs that contain breaking changes and should be released in the next major version. wip Issues and PRs that are still a work in progress.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants