diff options
author | Luca Casonato <hello@lcas.dev> | 2023-09-16 07:48:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-16 07:48:31 +0200 |
commit | 430b63c2c4d6567a77e77980058ef13b45a9f30e (patch) | |
tree | 714fef4813a5614ccdd17b681f30e3bd0b4057bd /cli/tests/unit/net_test.ts | |
parent | bf0760411336ce5ebb1c103f766c8154af478414 (diff) |
perf: improve async op santizer speed and accuracy (#20501)
This commit improves async op sanitizer speed by only delaying metrics
collection if there are pending ops. This
results in a speedup of around 30% for small CPU bound unit tests.
It performs this check and possible delay on every collection now,
fixing an issue with parent test leaks into steps.
Diffstat (limited to 'cli/tests/unit/net_test.ts')
-rw-r--r-- | cli/tests/unit/net_test.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/cli/tests/unit/net_test.ts b/cli/tests/unit/net_test.ts index ca4c5191c..54edf31fc 100644 --- a/cli/tests/unit/net_test.ts +++ b/cli/tests/unit/net_test.ts @@ -901,7 +901,7 @@ Deno.test( ); Deno.test({ permissions: { net: true } }, async function whatwgStreams() { - (async () => { + const server = (async () => { const listener = Deno.listen({ hostname: "127.0.0.1", port: listenPort }); const conn = await listener.accept(); await conn.readable.pipeTo(conn.writable); @@ -920,6 +920,7 @@ Deno.test({ permissions: { net: true } }, async function whatwgStreams() { assert(!done); assertEquals(decoder.decode(value), "Hello World"); await reader.cancel(); + await server; }); Deno.test( @@ -973,7 +974,7 @@ Deno.test( Deno.test( { permissions: { read: true, run: true } }, - async function netListenUnref() { + async function netListenUnref2() { const [statusCode, _output] = await execCode(` async function main() { const listener = Deno.listen({ port: ${listenPort} }); |