blog: More streams2 wordsmithing

This commit is contained in:
isaacs 2012-12-21 00:46:40 +00:00
parent 0c867ae618
commit 9d0103d22e

View File

@ -1,6 +1,6 @@
title: A New Streaming API for Node v0.10 title: A New Streaming API for Node v0.10
author: Isaac Z. Schlueter author: Isaac Z. Schlueter
date: Fri Dec 21 00:08:22 UTC 2012 date: Fri Dec 21 00:45:13 UTC 2012
slug: streams2 slug: streams2
category: feature category: feature
@ -11,7 +11,7 @@ category: feature
* A new Stream implementation is coming in 0.10, that has gotten the * A new Stream implementation is coming in 0.10, that has gotten the
nickname "streams2". nickname "streams2".
* Readable streams have a `read()` method that returns a buffer or * Readable streams have a `read()` method that returns a buffer or
null. null. (More documentation included below.)
* `'data'` events, `pause()`, and `resume()` will still work as before * `'data'` events, `pause()`, and `resume()` will still work as before
(except that they'll actully work how you'd expect). (except that they'll actully work how you'd expect).
* Old programs will **almost always** work without modification, but * Old programs will **almost always** work without modification, but
@ -50,22 +50,22 @@ v0.8. In a nutshell:
Common simple tasks should be easy, or we aren't doing our job. Common simple tasks should be easy, or we aren't doing our job.
People often say that Node is better than most other platforms at this People often say that Node is better than most other platforms at this
stuff, but in my opinion, that just is an indictment of the current stuff, but in my opinion, that is less of a compliment and more of an
state of software more than a compliment. Being better than the next indictment of the current state of software. Being better than the
guy isn't enough; we have to be the best imaginable, and while it was next guy isn't enough; we have to be the best imaginable. While they
a big step in the right direction, the Streams in Node up until now were a big step in the right direction, the Streams in Node up until
leave a lot wanting. now leave a lot wanting.
So, just fix it, right? So, just fix it, right?
Well, we are now sitting on the results of several years of explosive Well, we are sitting on the results of several years of explosive
growth in the Node community, so any chnages have to be made very growth in the Node community, so any changes have to be made very
carefully. If we break all the Node programs in 0.10, then no one carefully. If we break all the Node programs in 0.10, then no one
will ever want to upgrade to 0.10, and it's all pointless. We had will ever want to upgrade to 0.10, and it's all pointless. We had
this streams conversation around 0.4, then again around 0.6, then this conversation around 0.4, then again around 0.6, then again around
again around 0.8. Every time, the conclusion was "Too much work, too 0.8. Every time, the conclusion has been "Too much work, too hard to
hard to make backwards-compatible", and we always had other more make backwards-compatible", and we always had more pressing problems
pressing problems to solve. to solve.
In 0.10, we cannot put it off any longer. We've bitten the bullet and In 0.10, we cannot put it off any longer. We've bitten the bullet and
are making a significant change to the Stream implementation. You may are making a significant change to the Stream implementation. You may
@ -73,21 +73,21 @@ have seen conversations on twitter or IRC or the mailing list about
"streams2". I also gave [a talk in "streams2". I also gave [a talk in
November](https://dl.dropbox.com/u/3685/presentations/streams2/streams2-ko.pdf) November](https://dl.dropbox.com/u/3685/presentations/streams2/streams2-ko.pdf)
about this subject. A lot of node module authors have been involved about this subject. A lot of node module authors have been involved
with the development of streams2 (and of course the node core team), with the development of streams2 (and of course the node core team).
and at this point, I'm confident that it's an improvement over what
we've got.
## streams2 ## streams2
The feature is described pretty thoroughly in the documentation, so The feature is described pretty thoroughly in the documentation, so
I'm including it below. Please read it, especially the section on I'm including it below. Please read it, especially the section on
"compatibility". "compatibility". There's a caveat there that is unfortunately
unavoidable, but hopefully enough of an edge case that it's easily
worked around.
The first preview release with this change will be 0.9.4. I highly The first preview release with this change will be 0.9.4. I highly
recommend trying this release and providing feedback before it lands recommend trying this release and providing feedback before it lands
in a stable version. in a stable version.
As of this writing, there are some known performance regressions, As of writing this post, there are some known performance regressions,
especially in the http module. We are fanatical about maintaining especially in the http module. We are fanatical about maintaining
performance in Node.js, so of course this will have to be fixed before performance in Node.js, so of course this will have to be fixed before
the v0.10 stable release. (Watch for a future blog post on the tools the v0.10 stable release. (Watch for a future blog post on the tools
@ -97,10 +97,10 @@ There may be minor changes as necessary to fix bugs and improve
performance, but the API at this point should be considered feature performance, but the API at this point should be considered feature
complete. It correctly does all the things we need it to do, it just complete. It correctly does all the things we need it to do, it just
doesn't do them quite well enough yet. As always, be wary of running doesn't do them quite well enough yet. As always, be wary of running
unstable releases in production, of course, but I would like to unstable releases in production, of course, but I encourage you to try
encourage you to try it out and see what you think. Especially, if it out and see what you think. Especially, if you have tests that you
you have tests that you can run on your modules and libraries, that can run on your modules and libraries, that would be extremely useful
would be extremely useful feedback. feedback.
-------- --------