Browse Source

Remove some HandleScopes from HTTP

for a %2.5 improvement in hello world HTTP score.
v0.7.4-release
Ryan Dahl 15 years ago
parent
commit
c723acc721
  1. 10
      src/node_http.cc

10
src/node_http.cc

@ -129,8 +129,6 @@ HTTPConnection::OnEOF ()
int int
HTTPConnection::on_message_begin (http_parser *parser) HTTPConnection::on_message_begin (http_parser *parser)
{ {
HandleScope scope;
if (message_begin_symbol.IsEmpty()) { if (message_begin_symbol.IsEmpty()) {
method_symbol = NODE_PSYMBOL("method"); method_symbol = NODE_PSYMBOL("method");
status_code_symbol = NODE_PSYMBOL("statusCode"); status_code_symbol = NODE_PSYMBOL("statusCode");
@ -186,7 +184,6 @@ HTTPConnection::on_message_complete (http_parser *parser)
int int
HTTPConnection::on_url (http_parser *parser, const char *buf, size_t len) HTTPConnection::on_url (http_parser *parser, const char *buf, size_t len)
{ {
HandleScope scope;
HTTPConnection *connection = static_cast<HTTPConnection*>(parser->data); HTTPConnection *connection = static_cast<HTTPConnection*>(parser->data);
assert(connection->refs_); assert(connection->refs_);
Local<Value> argv[1] = { String::New(buf, len) }; Local<Value> argv[1] = { String::New(buf, len) };
@ -197,7 +194,6 @@ HTTPConnection::on_url (http_parser *parser, const char *buf, size_t len)
int int
HTTPConnection::on_query_string (http_parser *parser, const char *buf, size_t len) HTTPConnection::on_query_string (http_parser *parser, const char *buf, size_t len)
{ {
HandleScope scope;
HTTPConnection *connection = static_cast<HTTPConnection*>(parser->data); HTTPConnection *connection = static_cast<HTTPConnection*>(parser->data);
assert(connection->refs_); assert(connection->refs_);
Local<Value> argv[1] = { String::New(buf, len) }; Local<Value> argv[1] = { String::New(buf, len) };
@ -208,7 +204,6 @@ HTTPConnection::on_query_string (http_parser *parser, const char *buf, size_t le
int int
HTTPConnection::on_path (http_parser *parser, const char *buf, size_t len) HTTPConnection::on_path (http_parser *parser, const char *buf, size_t len)
{ {
HandleScope scope;
HTTPConnection *connection = static_cast<HTTPConnection*>(parser->data); HTTPConnection *connection = static_cast<HTTPConnection*>(parser->data);
assert(connection->refs_); assert(connection->refs_);
Local<Value> argv[1] = { String::New(buf, len) }; Local<Value> argv[1] = { String::New(buf, len) };
@ -219,7 +214,6 @@ HTTPConnection::on_path (http_parser *parser, const char *buf, size_t len)
int int
HTTPConnection::on_fragment (http_parser *parser, const char *buf, size_t len) HTTPConnection::on_fragment (http_parser *parser, const char *buf, size_t len)
{ {
HandleScope scope;
HTTPConnection *connection = static_cast<HTTPConnection*>(parser->data); HTTPConnection *connection = static_cast<HTTPConnection*>(parser->data);
assert(connection->refs_); assert(connection->refs_);
Local<Value> argv[1] = { String::New(buf, len) }; Local<Value> argv[1] = { String::New(buf, len) };
@ -240,7 +234,6 @@ const static char normalizer[] =
int int
HTTPConnection::on_header_field (http_parser *parser, const char *buf, size_t len) HTTPConnection::on_header_field (http_parser *parser, const char *buf, size_t len)
{ {
HandleScope scope;
HTTPConnection *connection = static_cast<HTTPConnection*>(parser->data); HTTPConnection *connection = static_cast<HTTPConnection*>(parser->data);
assert(connection->refs_); assert(connection->refs_);
@ -257,7 +250,6 @@ HTTPConnection::on_header_field (http_parser *parser, const char *buf, size_t le
int int
HTTPConnection::on_header_value (http_parser *parser, const char *buf, size_t len) HTTPConnection::on_header_value (http_parser *parser, const char *buf, size_t len)
{ {
HandleScope scope;
HTTPConnection *connection = static_cast<HTTPConnection*>(parser->data); HTTPConnection *connection = static_cast<HTTPConnection*>(parser->data);
assert(connection->refs_); assert(connection->refs_);
@ -293,7 +285,6 @@ HTTPConnection::on_headers_complete (http_parser *parser)
{ {
HTTPConnection *connection = static_cast<HTTPConnection*> (parser->data); HTTPConnection *connection = static_cast<HTTPConnection*> (parser->data);
assert(connection->refs_); assert(connection->refs_);
HandleScope scope;
Local<Object> message_info = Object::New(); Local<Object> message_info = Object::New();
@ -339,7 +330,6 @@ HTTPConnection::on_body (http_parser *parser, const char *buf, size_t len)
HTTPConnection *connection = static_cast<HTTPConnection*> (parser->data); HTTPConnection *connection = static_cast<HTTPConnection*> (parser->data);
assert(connection->refs_); assert(connection->refs_);
HandleScope scope;
// TODO each message should have their encoding. // TODO each message should have their encoding.
// don't look at the conneciton for encoding // don't look at the conneciton for encoding

Loading…
Cancel
Save