summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2013-11-27 03:48:44 +0100
committerBen Noordhuis <info@bnoordhuis.nl>2013-11-27 03:53:45 +0100
commit658aeb2ca0f7c99c002db149d6e91154ff0e2c2d (patch)
tree75db10ac2410f3c31d6caf95712df9445cacdb46
parent90655a998e8805826e364571004bb995eaa08967 (diff)
downloadnode-658aeb2ca0f7c99c002db149d6e91154ff0e2c2d.tar.gz
stream_wrap: don't call Number::New()
Replace call to Number::New() with a call to Integer::NewFromUnsigned(). Profiling a Real World(TM) application with perf(1) suggests that the conversion of its argument from integer to double is disproportionally costly: over 60% of CPU cycles accountable to WriteStringImpl() are attributable to the conversion. After changing it to Integer::NewFromUnsigned(), WriteStringImpl() has dropped from the 'most costly functions' top ten altogether.
-rw-r--r--src/stream_wrap.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/stream_wrap.cc b/src/stream_wrap.cc
index a1e7ded17..f01884666 100644
--- a/src/stream_wrap.cc
+++ b/src/stream_wrap.cc
@@ -412,7 +412,7 @@ Handle<Value> StreamWrap::WriteStringImpl(const Arguments& args) {
}
req_wrap->Dispatched();
- req_wrap->object_->Set(bytes_sym, Number::New((uint32_t) data_size));
+ req_wrap->object_->Set(bytes_sym, Integer::NewFromUnsigned(data_size));
wrap->UpdateWriteQueueSize();