diff options
author | Ryan <ry@tinyclouds.org> | 2009-08-23 12:20:25 +0200 |
---|---|---|
committer | Ryan <ry@tinyclouds.org> | 2009-08-23 12:32:49 +0200 |
commit | 316e2833f017150d58392f5ee82d86438ec22d5f (patch) | |
tree | 8499a41e8ecc6275cf291263665c2faca3734754 /benchmark/http_simple.js | |
parent | 9c97b1db3099d61cd292aa59ec2227a619f3a7ab (diff) | |
download | node-new-316e2833f017150d58392f5ee82d86438ec22d5f.tar.gz |
Use flat object instead of array-of-arrays for HTTP headers.
E.G. { "Content-Length": 10, "Content-Type": "text/html" } instead of
[["Content-Length", 10], ["Content-Type", "text/html"]].
The main reason for this change is object-creation efficiency.
This still needs testing and some further changes (like when receiving
multiple header lines with the same field-name, they are concatenated with a
comma but some headers ("Content-Length") should not be concatenated ; the
new header line should replace the old value).
Various thoughts on this subject:
http://groups.google.com/group/nodejs/browse_thread/thread/9a67bb32706d9efc#
http://four.livejournal.com/979640.html
http://mail.gnome.org/archives/libsoup-list/2009-March/msg00015.html
Diffstat (limited to 'benchmark/http_simple.js')
-rw-r--r-- | benchmark/http_simple.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/benchmark/http_simple.js b/benchmark/http_simple.js index 099a641862..d1801e7fd5 100644 --- a/benchmark/http_simple.js +++ b/benchmark/http_simple.js @@ -40,9 +40,9 @@ node.http.createServer(function (req, res) { var content_length = body.length.toString(); res.sendHeader( status - , [ ["Content-Type", "text/plain"] - , ["Content-Length", content_length] - ] + , { "Content-Type": "text/plain" + , "Content-Length": content_length + } ); res.sendBody(body); |