-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Pass args to process.nextTick() #1077
Conversation
0d1d754
to
5e34bae
Compare
@@ -339,6 +337,8 @@ function onwrite(stream, er) { | |||
} | |||
|
|||
if (sync) { | |||
// TODO(trevnorris): Yank this, but first need to figure out why |
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.
Any chance of figuring this out before merging?
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 will. Just don't have the brain cells at the moment to figure out why process.nextTick()
returns undefined
in the mentioned test.
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 just tested this and all tests (including test-repl-timeout-throw
) still pass after changing this additional instance of process.nextTick()
to process.nextTick(afterWrite, stream, state, finished, cb);
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.
Thanks. I'll make the change to the PR.
this is a tiny bit gross and a quite a leaky abstraction, I'm not really a fan of exposing ugly APIs just because it's the fastest way--fine if it's an internal API for the sake of cleaning up and speeding up (does it really do either of those?) but now we have to expose this to users.
|
@rvagg leaky? and it does both clean up and speed up (removing the need for additional function closures, flatten function declarations and no need to create an actual array). I played with the other API decision, but it causes far too many DEOPTs in |
leaky abstraction in the sense that your abstraction is saying too much about the implementation -- you're declaring to the world that you had to make compromises on your API to get other outcomes (performance), there has to be a tradeoff between pure perf and the best internal implementation and the API we expose to users and I'm here representing the API and this is that tradeoff discussion |
I agree with @rvagg. This adds API that may seem nice and fast now but we have to support it forever. It would be more helpful if the setArgs api was strictly internal. |
@piscisaureus as in |
I also agree with @rvagg on this. If we do need an ugly API, then let us try to find a way to not expose it. |
+1 on making this internal. See discussion in #953 |
This is quite dirty design, totally not common to similar API's, that people are familiar with. |
5e34bae
to
8828d49
Compare
@medikoo I don't appreciate "dirty design". Yes it's uncommon, but in terms of code complexity and performance it's the cleanest.
|
sigh one more "private" thing that people will use |
@vkurchatkin I figured the fact that using |
I echo your sigh here, could we make use of |
@rvagg unless we're willing to either 1) remove |
we can have this without internal modules @trevnorris I'm thinking about 2: user facing one would be just a wrapper of internal one |
process.nextTick(function() { | ||
emitReadable_(stream); | ||
}); | ||
process.nextTick(emitReadable_)._setArgs(stream); |
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.
This may prove problematic for porting it to readable-stream, since it's using an API that browserify (almost certainly) does not support.
If we end up going this route, I'm in favor of going the internal module + private symbol approach for solving this so we don't expose the (This is also a fairly precarious change for readable-stream, no matter which way the flow of code goes. Either way, it may not have access to |
@chrisdickinson I propose injecting private |
@vkurchatkin Then we have two |
@chrisdickinson What I mean is something like this: |
@trevnorris can you comment on why this API is faster than
? I assume it was because you don't want to slice fn off the start of |
@vkurchatkin How does that private |
it is passed as an argument to module wrapper. Not a good idea for |
Oh, and if nextTick is worth making better for use in iojs, its worth making it better for everybody, IMHO. |
@sam-github It makes the call to |
I won't accept |
Just thinking through this out loud, with regards to readable streams: even with an exposed |
@trevnorris thanks, I get it. It is unfortunately ugly... but that might limit its use to just performance-critical code... which would be OK. Is megamorphic even a word? :-) |
This could be also merged right now as an unobservable change (with the doc changes reverted) and make the public API "release" later in a semver-minor. |
Thanks @petkaantonov. That would be my preference. |
@trevnorris done any benchmarks yet? I see that was the resolution as of the tc-meeting it was discussed in. |
@Fishrock123 some. Initial results showed improvements just above the margin of error. Part of the gain also comes from easier performance debugging, since functions won't DEOPT from being scoped. It's possible to create a benchmark that shows significant gains, but this is definitely a micro optimization. |
@iojs/tc Was this supposed to have landed before the 1.7 release? |
LGTM. Starting CI to verify. |
PR-URL: #1077 Reviewed-by: Colin Ihrig <[email protected]>
Thanks. Landed in 10e31ba. |
Possibly stupid question, but seeing this is server-minor - is 1.8.0 our next release? |
@jbergstroem yes, either that or 2.0.0 if we get the https://github.com/iojs/io.js/milestones/2.0.0 changes sorted out |
@jbergstroem this should have been merged before 1.7 but wasn't. |
Ok. I was pretty keen on getting 1.7.2 within a week or so with a fix to a shared build. Guessing 2.0 might make that easier since we'd branch off to master/1.x/2.x? |
Notable Changes: * build: Support for building io.js as a static library (Marat Abdullin) #1341 * deps: upgrade openssl to 1.0.2a (Shigeki Ohtsu) #1389 * npm: Upgrade npm to 2.8.3. (Forrest L Norvell) #1448 * src: allow multiple arguments to be passed to process.nextTick (Trevor Norris) #1077 * module: interaction of require('.') with NODE_PATH has been restored and deprecated. This functionality will be removed at a later point. (Roman Reiss) #1363
Notable Changes: * build: Support for building io.js as a static library (Marat Abdullin) #1341 * deps: upgrade openssl to 1.0.2a (Shigeki Ohtsu) #1389 * npm: Upgrade npm to 2.8.3. (Forrest L Norvell) #1448 * src: allow multiple arguments to be passed to process.nextTick (Trevor Norris) #1077 * module: the interaction of require('.') with NODE_PATH has been restored and deprecated. This functionality will be removed at a later point. (Roman Reiss) #1363
🎉 🎉 Awesome! 🎉 🎉 |
Notable Changes: * build: revert vcbuild.bat changes * changes inherited from v1.8.0: * build: Support for building io.js as a static library (Marat Abdullin) #1341 * npm: Upgrade npm to 2.8.3. (Forrest L Norvell) #1448 * deps: upgrade openssl to 1.0.2a (Shigeki Ohtsu) #1389 * src: allow multiple arguments to be passed to process.nextTick (Trevor Norris) #1077 * module: the interaction of require('.') with NODE_PATH has been restored and deprecated. This functionality will be removed at a later point. (Roman Reiss) #1363
Since nobody mentioned it: Isn't |
@igl Yes, well only that, it's like 100000x slower. |
Now allow
process.nextTick(callback[, ... vargs])
R=@bnoordhuis