pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/nodejs/node/commit/44660c175733d5403663f446c57874df44ab08ea

r-b69241e157469407.css" /> test: optimize test-http2-large-file · nodejs/node@44660c1 · GitHub
Skip to content

Commit 44660c1

Browse files
TrottMylesBorins
authored andcommitted
test: optimize test-http2-large-file
Optimize test-http2-large-file so it only allocates a single buffer. PR-URL: #26737 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Adrian Estrada <edsadr@gmail.com>
1 parent ddfa756 commit 44660c1

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

test/sequential/test-http2-large-file.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
// Test to ensure sending a large stream with a large initial window size works
3+
// Test sending a large stream with a large initial window size.
44
// See: https://github.com/nodejs/node/issues/19141
55

66
const common = require('../common');
@@ -18,14 +18,15 @@ server.on('stream', (stream) => {
1818

1919
server.listen(0, common.mustCall(() => {
2020
let remaining = 1e8;
21-
const chunk = 1e6;
21+
const chunkLength = 1e6;
22+
const chunk = Buffer.alloc(chunkLength, 'a');
2223
const client = http2.connect(`http://localhost:${server.address().port}`,
2324
{ settings: { initialWindowSize: 6553500 } });
2425
const request = client.request({ ':method': 'POST' });
2526
function writeChunk() {
2627
if (remaining > 0) {
27-
remaining -= chunk;
28-
request.write(Buffer.alloc(chunk, 'a'), writeChunk);
28+
remaining -= chunkLength;
29+
request.write(chunk, writeChunk);
2930
} else {
3031
request.end();
3132
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy