mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
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.
This commit is contained in:
1 parent
90655a998e
commit
658aeb2ca0
1 file changed
+1
-1
+1
-1
@@ -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();
|
||||
|
||||
|
||||
Reference in new issue
Block a user