Still, your bench is wrong because the two programs do different things:

* The streamline program calls socket.write from the callback of the 
previous socket.write. So it does proper flow control and it won't overflow 
output buffers.
* The callback program calls socket.write in a loop, without chaining them 
through the callbacks. No flow control here!

So please, go back to the drawing board and come back with a fair bench.

Hint: the callback version should not run the bench with a for loop, it 
should transform the loop into a recursion (which is what streamline does).


On Tuesday, April 10, 2012 5:32:45 PM UTC+2, Joe Ferner wrote:
>
> On Apr 10, 11:12 am, Bruno Jouhier <[email protected]> wrote: 
> > Your bench does not make sense. There is no async call at all. So there 
> is no reason to have an _ in the streamline source. 
> > 
> > Streamline does not transform sync fonctions. So the Streamline version 
> of this bench should take 3 ms. 
> > 
> > Callback != asynchronous 
> > 
> > Try again with an async call 
>
> I was trying to demonstrate the call overhead but here is an example 
> with some async code https://gist.github.com/2352116 again a bit 
> contrived because I really didn't want to spend much time on this. 
>
> streamline did close the gap a bit which is what I suspected when I 
> said "I will agree that for many real world cases this is a tiny piece 
> of the overall time". But it was still twice as slow. (node 565ms and 
> streamline 1049ms) 
>
>
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to