]> zoso.dev Git - buffer.git/commit
avoid .toLowerCase() call in Buffer#write()
authorFeross Aboukhadijeh <feross@feross.org>
Mon, 20 Apr 2015 21:28:41 +0000 (14:28 -0700)
committerFeross Aboukhadijeh <feross@feross.org>
Mon, 20 Apr 2015 21:28:41 +0000 (14:28 -0700)
commit1734f01ca3dea06f4ef7f6361d50818b51d38f44
treed77e915366846dca80cfde80c456f3bfe4424bdd
parent0c465f0857f7875ae995896ac850fa0df4c637c7
avoid .toLowerCase() call in Buffer#write()

Avoid a costly String#toLowerCase() call in Buffer#write() in the
common case, i.e., that the string is already lowercase.  Reduces
the running time of the following benchmark by about 40%:

for (var b = Buffer(1), i = 0; i < 25e6; ++i) b.write('x', 'ucs2');

From
https://github.com/iojs/io.js/commit/4ddd6406ce1c474e1a54a5aa9b56f755490
2fd10
index.js