projects
/
platform
/
upstream
/
nodejs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e04cb1e
)
stream: avoid unnecessary concat of a single buffer.
author
Calvin Metcalf
<cmetcalf@appgeo.com>
Fri, 9 Oct 2015 18:50:11 +0000
(14:50 -0400)
committer
James M Snell
<jasnell@gmail.com>
Thu, 29 Oct 2015 15:38:40 +0000
(08:38 -0700)
Avoids doing a buffer.concat on the internal buffer
when that array has only a single thing in it.
Reviewed-By: Chris Dickinson <chris@neversaw.us>
Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/3300
lib/_stream_readable.js
patch
|
blob
|
history
diff --git
a/lib/_stream_readable.js
b/lib/_stream_readable.js
index
5a37532
..
ab47830
100644
(file)
--- a/
lib/_stream_readable.js
+++ b/
lib/_stream_readable.js
@@
-836,6
+836,8
@@
function fromList(n, state) {
// read it all, truncate the array.
if (stringMode)
ret = list.join('');
+ else if (list.length === 1)
+ ret = list[0];
else
ret = Buffer.concat(list, length);
list.length = 0;