Commit 6feea08
buffer: preallocate array with buffer length
Because the final array length is known, it's better to allocate its
final length at initialization time to avoid future reallocations.
Also add an explicit buffer length greater than 0 comparison so
it's more readable, avoids the internal ToBoolean call and follows the
standard Node.js API format (as it can be checked in other similar
structures where 'length > 0' is preferred over 'length')
PR-URL: #11733
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>1 parent a703bde commit 6feea08Copy full SHA for 6feea08
File tree
Expand file treeCollapse file tree
1 file changed
+2
-2
lines changedOpen diff view settings
Filter options
- lib
Expand file treeCollapse file tree
1 file changed
+2
-2
lines changedOpen diff view settings
Collapse file
+2-2Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
799 | 799 | |
800 | 800 | |
801 | 801 | |
802 | | - |
803 | | - |
| 802 | + |
| 803 | + |
804 | 804 | |
805 | 805 | |
806 | 806 | |
|
0 commit comments