Ah never mind my fault. Needed "socket.connect(1111, 'localhost',
function(_) {" (missing underscore here).On Apr 10, 8:16 pm, Joe Ferner <[email protected]> wrote: > On Apr 10, 5:01 pm, Axel Kittenberger <[email protected]> wrote: > > > > > > > > > > > > If I want to mix the syntax, let me, don't error out. > > > I lets you mix it, you just have to do it correctly. E.g: this works > > without error: > > > function foo(_) { > > process.nextTick(_); > > console.log('a'); > > process.nextTick(function() { > > console.log('b'); > > });} > > > foo(_); > > > Don't blame streamline for your own shortcomings. I know of its > > drawbacks in debugging mode, but thats about it, i get tired and angry > > about the FUD spread around it, and you made a ton of it. > > Ok then perhaps you can fix my code because this gives me the error > and from what I can tell it looks to follow your pattern... > > var net = require('net'); > > function foo(_) { > var socket = new net.Socket(); > socket.connect(1111, 'localhost', function() { > var start = new Date(); > for (var i = 0; i <= 100000; i++) { > socket.write(new Buffer([i]), _); > } > var end = new Date(); > console.log("done: " + (end - start)); > > socket.end(); > }); > > } > > foo(_); > > > > > > I just don't have time to write more benchmarks that no mater what I > > > come up with Bruno will find another reason why it isn't valid. > > > Its not like Bruno is doing an evil plot here. Since as long your > > benchmark does not compare apple with oranges, it will always be just > > as fast as vanilla written code, since in the end, it translates to > > vanilla code. > > I disagree about my benchmarks being incorrect. Benchmark 1 was to > purely compare the overhead of calling functions using traditional > methods vs streamline. Methods with callbacks are not required to have > async code in them, they just generally do. If you replace doIt with > say a getUserFromCache method where 99% of the time you get cache hits > and the function just returns the user this would be completely valid > and you would incur the penalty. But I played along and tossed in an > async call. Benchmark 2 is valid if you want to send data as fast as > possible to the other side. I would love to see this magical > benchmark that streamline is as fast or faster than node but I have > yet to see it. -- 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
