Skip to content

Commit

Permalink
Convert table in README to Markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
szepeviktor authored Jan 2, 2025
1 parent 1359605 commit 3c5e34f
Showing 1 changed file with 28 additions and 32 deletions.
60 changes: 28 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,20 @@ npm i undici
The benchmark is a simple getting data [example](https://github.com/nodejs/undici/blob/main/benchmarks/benchmark.js) using a
50 TCP connections with a pipelining depth of 10 running on Node 22.11.0.

```
┌────────────────────────┬─────────┬────────────────────┬────────────┬─────────────────────────┐
│ Tests │ Samples │ Result │ Tolerance │ Difference with slowest │
├────────────────────────┼─────────┼────────────────────┼────────────┼─────────────────────────┤
│ 'axios' │ 15 │ '5708.26 req/sec' │ '± 2.91 %' │ '-' │
│ 'http - no keepalive' │ 10 │ '5809.80 req/sec' │ '± 2.30 %' │ '+ 1.78 %' │
│ 'request' │ 30 │ '5828.80 req/sec' │ '± 2.91 %' │ '+ 2.11 %' │
│ 'undici - fetch' │ 40 │ '5903.78 req/sec' │ '± 2.87 %' │ '+ 3.43 %' │
│ 'node-fetch' │ 10 │ '5945.40 req/sec' │ '± 2.13 %' │ '+ 4.15 %' │
│ 'got' │ 35 │ '6511.45 req/sec' │ '± 2.84 %' │ '+ 14.07 %' │
│ 'http - keepalive' │ 65 │ '9193.24 req/sec' │ '± 2.92 %' │ '+ 61.05 %' │
│ 'superagent' │ 35 │ '9339.43 req/sec' │ '± 2.95 %' │ '+ 63.61 %' │
│ 'undici - pipeline' │ 50 │ '13364.62 req/sec' │ '± 2.93 %' │ '+ 134.13 %' │
│ 'undici - stream' │ 95 │ '18245.36 req/sec' │ '± 2.99 %' │ '+ 219.63 %' │
│ 'undici - request' │ 50 │ '18340.17 req/sec' │ '± 2.84 %' │ '+ 221.29 %' │
│ 'undici - dispatch' │ 40 │ '22234.42 req/sec' │ '± 2.94 %' │ '+ 289.51 %' │
└────────────────────────┴─────────┴────────────────────┴────────────┴─────────────────────────┘
```
| Tests | Samples | Result | Tolerance | Difference with slowest |
| ----- | ------: | ------ | --------- | ----------------------- |
| axios | 15 | 5708.26 req/sec | ± 2.91 % | - |
| http - no keepalive | 10 | 5809.80 req/sec | ± 2.30 % | + 1.78 % |
| request | 30 | 5828.80 req/sec | ± 2.91 % | + 2.11 % |
| undici - fetch | 40 | 5903.78 req/sec | ± 2.87 % | + 3.43 % |
| node-fetch | 10 | 5945.40 req/sec | ± 2.13 % | + 4.15 % |
| got | 35 | 6511.45 req/sec | ± 2.84 % | + 14.07 % |
| http - keepalive | 65 | 9193.24 req/sec | ± 2.92 % | + 61.05 % |
| superagent | 35 | 9339.43 req/sec | ± 2.95 % | + 63.61 % |
| undici - pipeline | 50 | 13364.62 req/sec | ± 2.93 % | + 134.13 % |
| undici - stream | 95 | 18245.36 req/sec | ± 2.99 % | + 219.63 % |
| undici - request | 50 | 18340.17 req/sec | ± 2.84 % | + 221.29 % |
| undici - dispatch | 40 | 22234.42 req/sec | ± 2.94 % | + 289.51 % |

## Quick Start

Expand Down Expand Up @@ -108,7 +104,7 @@ This section documents our most commonly used API methods. Additional APIs are d

Arguments:

* **url** `string | URL | UrlObject`
* **url** `string URL UrlObject`
* **options** [`RequestOptions`](./docs/docs/api/Dispatcher.md#parameter-requestoptions)
* **dispatcher** `Dispatcher` - Default: [getGlobalDispatcher](#undicigetglobaldispatcher)
* **method** `String` - Default: `PUT` if `options.body`, otherwise `GET`
Expand All @@ -123,7 +119,7 @@ See [Dispatcher.request](./docs/docs/api/Dispatcher.md#dispatcherrequestoptions-

Arguments:

* **url** `string | URL | UrlObject`
* **url** `string URL UrlObject`
* **options** [`StreamOptions`](./docs/docs/api/Dispatcher.md#parameter-streamoptions)
* **dispatcher** `Dispatcher` - Default: [getGlobalDispatcher](#undicigetglobaldispatcher)
* **method** `String` - Default: `PUT` if `options.body`, otherwise `GET`
Expand All @@ -139,7 +135,7 @@ See [Dispatcher.stream](./docs/docs/api/Dispatcher.md#dispatcherstreamoptions-fa

Arguments:

* **url** `string | URL | UrlObject`
* **url** `string URL UrlObject`
* **options** [`PipelineOptions`](./docs/docs/api/Dispatcher.md#parameter-pipelineoptions)
* **dispatcher** `Dispatcher` - Default: [getGlobalDispatcher](#undicigetglobaldispatcher)
* **method** `String` - Default: `PUT` if `options.body`, otherwise `GET`
Expand All @@ -157,10 +153,10 @@ Starts two-way communications with the requested resource using [HTTP CONNECT](h

Arguments:

* **url** `string | URL | UrlObject`
* **url** `string URL UrlObject`
* **options** [`ConnectOptions`](./docs/docs/api/Dispatcher.md#parameter-connectoptions)
* **dispatcher** `Dispatcher` - Default: [getGlobalDispatcher](#undicigetglobaldispatcher)
* **callback** `(err: Error | null, data: ConnectData | null) => void` (optional)
* **callback** `(err: Error null, data: ConnectData null) => void` (optional)

Returns a promise with the result of the `Dispatcher.connect` method.

Expand Down Expand Up @@ -322,10 +318,10 @@ Upgrade to a different protocol. See [MDN - HTTP - Protocol upgrade mechanism](h

Arguments:

* **url** `string | URL | UrlObject`
* **url** `string URL UrlObject`
* **options** [`UpgradeOptions`](./docs/docs/api/Dispatcher.md#parameter-upgradeoptions)
* **dispatcher** `Dispatcher` - Default: [getGlobalDispatcher](#undicigetglobaldispatcher)
* **callback** `(error: Error | null, data: UpgradeData) => void` (optional)
* **callback** `(error: Error null, data: UpgradeData) => void` (optional)

Returns a promise with the result of the `Dispatcher.upgrade` method.

Expand All @@ -347,7 +343,7 @@ Returns: `Dispatcher`

### `undici.setGlobalOrigin(origin)`

* origin `string | URL | undefined`
* origin `string URL undefined`

Sets the global origin used in `fetch`.

Expand All @@ -369,7 +365,7 @@ Returns: `URL`

### `UrlObject`

* **port** `string | number` (optional)
* **port** `string number` (optional)
* **path** `string` (optional)
* **pathname** `string` (optional)
* **hostname** `string` (optional)
Expand Down Expand Up @@ -455,11 +451,11 @@ and `undici.Agent`) which will enable the family autoselection algorithm when es

Undici aligns with the Node.js LTS schedule. The following table shows the supported versions:

| Version | Node.js | End of Life |
|---------|-------------|-------------|
| 5.x | v18.x | 2024-04-30 |
| 6.x | v20.x v22.x | 2026-04-30 |
| 7.x | v24.x | 2027-04-30 |
Version Node.js End of Life
-----------------------------------
5.x v18.x 2024-04-30
6.x v20.x v22.x 2026-04-30
7.x v24.x 2027-04-30

## License

Expand Down

0 comments on commit 3c5e34f

Please sign in to comment.