1 // When calling .end(buffer) right away, this triggers a "hot path"
2 // optimization in http.js, to avoid an extra write call.
4 // However, the overhead of copying a large buffer is higher than
5 // the overhead of an extra write() call, so the hot path was not
6 // always as hot as it could be.
8 // Verify that our assumptions are valid.
10 var common = require('../common.js');
11 var PORT = common.PORT;
13 var bench = common.createBenchmark(main, {
20 http = require('http');
21 var chunk = new Buffer(conf.size);
24 var args = ['-d', '10s', '-t', 8, '-c', conf.c];
26 var server = http.createServer(function(req, res) {
28 if (left === 0) return res.end();
30 setTimeout(function() {
37 server.listen(common.PORT, function() {
38 bench.http('/', args, function() {