lib: avoid .toLowerCase() call in Buffer#write() · nodejs/node@4ddd640 · GitHub
Skip to content

Commit 4ddd640

Browse files
committed
lib: 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'); PR-URL: #1048 Reviewed-By: Trevor Norris <trev.norris@gmail.com>
1 parent bbf54a5 commit 4ddd640

1 file changed

Lines changed: 29 additions & 31 deletions

File tree

‎lib/buffer.js‎

Lines changed: 29 additions & 31 deletions

0 commit comments

Comments
 (0)