Fix native code
In my case, the output contains function () { [native code] } so that it's invalid to be read by the browser.
This is very bizarre. I wonder why there is a performance difference, because if you look at the source for net.createConnection:
exports.connect = exports.createConnection = function(port /* [host], [cb] */) {
var s;
if (isPipeName(port)) {
s = new Socket({ handle: createPipe() });
} else {
s = new Socket();
}
return s.connect(port, arguments[1], arguments[2]);
};
And on 0.4.12:
exports.createConnection = function(port, host) {
var s = new Socket();
s.connect(port, host);
return s;
};
Can you submit your pull request anyway?
I've sent a pull request. Let me know what you think.
I've also created a ticket on node.js issue tracker. https://github.com/joyent/node/issues/2597
For kicks, is it possible that the order in which the listeners and commands are added is affecting the speed? Did you try using your new patch and literally inlining the net.createConnection function body? (e.g. reverse patch on your patch)