Re: [nodejs] Why is my streaming word counter so much slower than a non streaming version?

2014-04-05 Thread Forrest Norvell
I don't think there's anything wrong with how you're using streams. Your version trades performance for a more consistent memory file, and theirs does the opposite. The nice thing about your implementation is that it can handle a much larger source file, and can start working before the whole file

Re: [nodejs] Why is my streaming word counter so much slower than a non streaming version?

2014-04-05 Thread Ryan Graham
On Sat, Apr 5, 2014 at 10:01 PM, Dan Schmidt wrote: > So, I'm trying to use streams more and better understand how to use them > properly. > > There was this little contest over at Treehouse to write an app that would > count the words in a text file after being filtered from a certain set of > wo

Re: [nodejs] Why is my streaming word counter so much slower than a non streaming version?

2014-04-06 Thread Dan Schmidt
Thanks for the insights. I had tried using much larger text files to compare the two, but wasn't considering that the synchronous will always beat it, so long as there is enough memory to read in the file. A better comparison would be to set them both up as web servers and send multiple requests.

Re: [nodejs] Why is my streaming word counter so much slower than a non streaming version?

2014-04-07 Thread Floby
As said before using streams would probably not show any performance in speed in your case but rather an improvement in memory usage and concurrency. Streams will chunk your input into smaller pieces of work which can then be scheduled more nicely over time. The synchronous version only takes t

RE: [nodejs] Why is my streaming word counter so much slower than a non streaming version?

2014-04-07 Thread Chad Engler
Why is my streaming word counter so much slower than a non streaming version? Thanks for the insights. I had tried using much larger text files to compare the two, but wasn't considering that the synchronous will always beat it, so long as there is enough memory to read in the file. A better c

Re: [nodejs] Why is my streaming word counter so much slower than a non streaming version?

2014-04-08 Thread Mikeal Rogers
ng it instead of loading it all and > parsing at once. > > -Chad > > From: nodejs@googlegroups.com [mailto:nodejs@googlegroups.com] On Behalf Of > Dan Schmidt > Sent: Sunday, April 06, 2014 5:35 PM > To: nodejs@googlegroups.com > Subject: Re: [nodejs] Why is my streami