-
-
Notifications
You must be signed in to change notification settings - Fork 756
feat: add sending data benchmark #2905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,22 +34,16 @@ if (process.env.PORT) { | |
| dest.socketPath = path.join(os.tmpdir(), 'undici.sock') | ||
| } | ||
|
|
||
| /** @type {http.RequestOptions} */ | ||
| const httpBaseOptions = { | ||
| protocol: 'http:', | ||
| hostname: 'localhost', | ||
| method: 'GET', | ||
| path: '/', | ||
| query: { | ||
| frappucino: 'muffin', | ||
| goat: 'scone', | ||
| pond: 'moose', | ||
| foo: ['bar', 'baz', 'bal'], | ||
| bool: true, | ||
| numberKey: 256 | ||
| }, | ||
|
Comment on lines
-42
to
-49
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is an invalid option and is not used. |
||
| ...dest | ||
| } | ||
|
|
||
| /** @type {http.RequestOptions} */ | ||
| const httpNoKeepAliveOptions = { | ||
| ...httpBaseOptions, | ||
| agent: new http.Agent({ | ||
|
|
@@ -58,6 +52,7 @@ const httpNoKeepAliveOptions = { | |
| }) | ||
| } | ||
|
|
||
| /** @type {http.RequestOptions} */ | ||
| const httpKeepAliveOptions = { | ||
| ...httpBaseOptions, | ||
| agent: new http.Agent({ | ||
|
|
@@ -142,7 +137,11 @@ class SimpleRequest { | |
| } | ||
|
|
||
| function makeParallelRequests (cb) { | ||
| return Promise.all(Array.from(Array(parallelRequests)).map(() => new Promise(cb))) | ||
| const promises = new Array(parallelRequests) | ||
| for (let i = 0; i < parallelRequests; ++i) { | ||
| promises[i] = new Promise(cb) | ||
| } | ||
| return Promise.all(promises) | ||
|
Comment on lines
+140
to
+144
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. reduce overhead |
||
| } | ||
|
|
||
| function printResults (results) { | ||
|
|
@@ -303,7 +302,7 @@ if (process.env.PORT) { | |
|
|
||
| experiments.got = () => { | ||
| return makeParallelRequests(resolve => { | ||
| got.get(dest.url, null, { http: gotAgent }).then(res => { | ||
| got.get(dest.url, { agent: { http: gotAgent } }).then(res => { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The agent is not configured correctly. |
||
| res.pipe(new Writable({ | ||
| write (chunk, encoding, callback) { | ||
| callback() | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.