1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-03 17:08:35 -05:00
denoland-deno/ext/node
Marcos Casagrande 578936b490 perf(ext/node): optimize http headers (#20163)
This PR optimizes Node's `IncomingMessageForServer.headers` by replacing
`Object.fromEntries()` with a loop and `headers.entries` with
`headersEntries` which returns the internal array directly instead of an
iterator

## Benchmarks

Using `wrk` with 5 headers

```
wrk -d 10s --latency -H "X-Deno: true" -H "Accept: application/json" -H "X-Foo: bar" -H "User-Agent: wrk" -H "Accept-Encoding: gzip, br" http://127.0.0.1:3000
```

**this PR**

```
Running 10s test @ http://127.0.0.1:3000
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   167.53us  136.89us   2.75ms   97.33%
    Req/Sec    31.98k     1.38k   36.39k    70.30%
  Latency Distribution
     50%  134.00us
     75%  191.00us
     90%  234.00us
     99%  544.00us
  642548 requests in 10.10s, 45.96MB read
Requests/sec:  63620.36
Transfer/sec:      4.55MB
```

**main**

```
Running 10s test @ http://127.0.0.1:3000
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   181.31us  132.54us   3.79ms   97.13%
    Req/Sec    29.21k     1.45k   32.93k    79.21%
  Latency Distribution
     50%  148.00us
     75%  198.00us
     90%  261.00us
     99%  545.00us
  586939 requests in 10.10s, 41.98MB read
Requests/sec:  58114.01
Transfer/sec:      4.16MB
```

```js
import express from "npm:express";

const app = express();
app.get("/", function (req, res) {
  req.headers;
  res.end();
});
app.listen(3000);
```
2023-08-21 18:23:27 +05:30
..
ops fix(ext/node): support dictionary option in zlib init (#20035) 2023-08-21 18:23:27 +05:30
polyfills perf(ext/node): optimize http headers (#20163) 2023-08-21 18:23:27 +05:30
analyze.rs chore: rename some helpers on the Fs trait (#20097) 2023-08-08 16:28:18 -04:00
build.rs build: allow disabling snapshots for dev (#20048) 2023-08-06 01:47:15 +02:00
Cargo.toml 1.36.1 (#20221) 2023-08-21 18:08:38 +05:30
clippy.toml refactor(ext/fs): deno_fs::FileSystem - conditional Send + Sync (#18993) 2023-05-08 11:02:02 -04:00
errors.rs fix(node): package path not exported error - add if types resolution was occurring (#19963) 2023-07-27 16:27:01 +00:00
global.rs perf: cache node resolution when accesing a global (#19930) 2023-07-25 23:43:00 +02:00
lib.rs build: allow disabling snapshots for dev (#20048) 2023-08-06 01:47:15 +02:00
package_json.rs chore: rename some helpers on the Fs trait (#20097) 2023-08-08 16:28:18 -04:00
path.rs chore(ext/node): fix variable name (#17948) 2023-02-27 21:26:02 +01:00
polyfill.rs fix(node): repl._builtinLibs (#20046) 2023-08-04 14:30:48 +02:00
README.md chore(ext/node): correct publishing for ext/node (#15461) 2022-08-11 17:25:41 -04:00
resolution.rs chore: rename some helpers on the Fs trait (#20097) 2023-08-08 16:28:18 -04:00

deno_node

require and other node related functionality for Deno.