GeezerVison is showing github.com — buffer: increase Buffer.poolSize default to 64 KiB · nodejs/node@d3ef412
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: doc/api/buffer.md +6-2Lines changed: 6 additions & 2 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -881,7 +881,7 @@ _may contain sensitive data_. Use [`buf.fill(0)`][`buf.fill()`] to initialize |
881 | 881 | such `Buffer` instances with zeroes. |
882 | 882 |
|
883 | 883 | When using [`Buffer.allocUnsafe()`][] to allocate new `Buffer` instances, |
884 | | -allocations less than `Buffer.poolSize >>> 1` (4KiB when default poolSize is used) are sliced |
| 884 | +allocations less than `Buffer.poolSize >>> 1` (32KiB when default poolSize is used) are sliced |
885 | 885 | from a single pre-allocated `Buffer`. This allows applications to avoid the |
886 | 886 | garbage collection overhead of creating many individually allocated `Buffer` |
887 | 887 | instances. This approach improves both performance and memory usage by |
@@ -1513,9 +1513,13 @@ console.log(Buffer.isEncoding('')); |
1513 | 1513 |
|
1514 | 1514 | <!-- YAML |
1515 | 1515 | added: v0.11.3 |
| 1516 | +changes: |
| 1517 | + - version: REPLACEME |
| 1518 | + pr-url: https://github.com/nodejs/node/pull/63597 |
| 1519 | + description: Default raised from 8192 to 65536. |
1516 | 1520 | --> |
1517 | 1521 |
|
1518 | | -* Type: {integer} **Default:** `8192` |
| 1522 | +* Type: {integer} **Default:** `65536` |
1519 | 1523 |
|
1520 | 1524 | This is the size (in bytes) of pre-allocated internal `Buffer` instances used |
1521 | 1525 | for pooling. This value may be modified. |
|
Collapse file
Copy file name to clipboardExpand all lines: lib/buffer.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -171,7 +171,7 @@ const constants = ObjectDefineProperties({}, { |
171 | 171 | }, |
172 | 172 | }); |
173 | 173 |
|
174 | | -Buffer.poolSize = 8 * 1024; |
| 174 | +Buffer.poolSize = 64 * 1024; |
175 | 175 | let poolSize, poolOffset, allocPool, allocBuffer; |
176 | 176 |
|
177 | 177 | function createPool() { |
|