stream_wrap: don't call Number::New()
authorBen Noordhuis <info@bnoordhuis.nl>
Wed, 27 Nov 2013 02:48:44 +0000 (03:48 +0100)
committerBen Noordhuis <info@bnoordhuis.nl>
Wed, 27 Nov 2013 02:53:45 +0000 (03:53 +0100)
commit658aeb2ca0f7c99c002db149d6e91154ff0e2c2d
tree75db10ac2410f3c31d6caf95712df9445cacdb46
parent90655a998e8805826e364571004bb995eaa08967
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.
src/stream_wrap.cc