Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/v0.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
bnoordhuis committed Dec 20, 2012
2 parents dcaebec + 5a19c07 commit 79ae8b7
Show file tree
Hide file tree
Showing 6 changed files with 661 additions and 19 deletions.
9 changes: 4 additions & 5 deletions benchmark/http_simple.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,12 @@ var server = http.createServer(function (req, res) {
'Transfer-Encoding': 'chunked' });
// send body in chunks
var len = body.length;
var step = ~~(len / n_chunks) || len;
var step = Math.floor(len / n_chunks) || 1;

for (var i = 0; i < len; i += step) {
res.write(body.slice(i, i + step));
for (var i = 0, n = (n_chunks - 1); i < n; ++i) {
res.write(body.slice(i * step, i * step + step));
}

res.end();
res.end(body.slice((n_chunks - 1) * step));
} else {
var content_length = body.length.toString();

Expand Down
9 changes: 4 additions & 5 deletions benchmark/http_simple_auto.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,12 @@ var server = http.createServer(function (req, res) {
"Transfer-Encoding": "chunked" });
// send body in chunks
var len = body.length;
var step = ~~(len / n_chunks) || len;
var step = Math.floor(len / n_chunks) || 1;

for (var i = 0; i < len; i += step) {
res.write(body.slice(i, i + step));
for (var i = 0, n = (n_chunks - 1); i < n; ++i) {
res.write(body.slice(i * step, i * step + step));
}

res.end();
res.end(body.slice((n_chunks - 1) * step));
} else {
var content_length = body.length.toString();

Expand Down
Loading

0 comments on commit 79ae8b7

Please sign in to comment.