1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 15:24:46 -05:00
denoland-deno/tests/node_compat
Divy Srivastava c7153838ec
fix(ext/node): implement TCP.setNoDelay (#26263)
Fixes https://github.com/denoland/deno/issues/26177

The significant delay was caused by Nagel's algorithm + delayed ACKs in
Linux kernels. Here's the [kernel
patch](https://lwn.net/Articles/502585/) which added 40ms
`tcp_default_delack_min`

```
$ deno run -A pg-bench.mjs # main
Tue Oct 15 2024 12:27:22 GMT+0530 (India Standard Time): 42ms

$ target/release/deno run -A pg-bench.mjs # this patch
Tue Oct 15 2024 12:28:02 GMT+0530 (India Standard Time): 1ms
```

```js
import { Buffer } from "node:buffer";

import pg from 'pg'
const { Client } = pg
const client = new Client({
    connectionString: 'postgresql://postgres:postgres@127.0.0.1:5432/postgres'
})
await client.connect()

async function fetch() {
    const startPerf = performance.now();
    const res = await client.query(`select
        $1::int as int,
        $2 as string,
        $3::timestamp with time zone as timestamp,
        $4 as null,
        $5::bool as boolean,
        $6::bytea as bytea,
        $7::jsonb as json
      `, [
        1337,
        'wat',
        new Date().toISOString(),
        null,
        false,
        Buffer.from('awesome'),
        JSON.stringify([{ some: 'json' }, { array: 'object' }])
    ])
    console.log(`${new Date()}: ${Math.round(performance.now() - startPerf)}ms`)
}

for(;;) await fetch();
```
2024-10-15 14:47:12 +05:30
..
runner fix(ext/node): implement TCP.setNoDelay (#26263) 2024-10-15 14:47:12 +05:30
test fix(ext/node): implement TCP.setNoDelay (#26263) 2024-10-15 14:47:12 +05:30
.gitignore chore: sync up Node.js test files for v20.11.1 (#24066) 2024-06-11 11:41:44 +00:00
common.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
config.jsonc fix(ext/node): implement TCP.setNoDelay (#26263) 2024-10-15 14:47:12 +05:30
deno.json chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
polyfill_globals.js chore: cleanup remaining internals.future code (#25624) 2024-09-16 09:28:35 +10:00
runner.ts chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
test.ts chore: enable no-console dlint rule (#25113) 2024-08-20 15:14:37 -04:00
test_runner.rs test: remove usage of --unstable flag (#25549) 2024-09-10 11:28:59 +00:00