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/testdata | |
| 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/testdata')
| -rw-r--r-- | cli/tests/testdata/test/ops_sanitizer_step_leak.out | 10 | ||||
| -rw-r--r-- | cli/tests/testdata/test/ops_sanitizer_step_leak.ts | 10 |
2 files changed, 20 insertions, 0 deletions
diff --git a/cli/tests/testdata/test/ops_sanitizer_step_leak.out b/cli/tests/testdata/test/ops_sanitizer_step_leak.out new file mode 100644 index 000000000..296c5e573 --- /dev/null +++ b/cli/tests/testdata/test/ops_sanitizer_step_leak.out @@ -0,0 +1,10 @@ +Check [WILDCARD]/cli/tests/testdata/test/ops_sanitizer_step_leak.ts +running 1 test from ./cli/tests/testdata/test/ops_sanitizer_step_leak.ts +timeout ... + step ... ok [WILDCARD] +------- output ------- +done +----- output end ----- +timeout ... ok [WILDCARD] + +ok | 1 passed (1 step) | 0 failed [WILDCARD]
\ No newline at end of file diff --git a/cli/tests/testdata/test/ops_sanitizer_step_leak.ts b/cli/tests/testdata/test/ops_sanitizer_step_leak.ts new file mode 100644 index 000000000..3fb9b397e --- /dev/null +++ b/cli/tests/testdata/test/ops_sanitizer_step_leak.ts @@ -0,0 +1,10 @@ +Deno.test("timeout", async (t) => { + const timer = setTimeout(() => { + console.log("timeout"); + }, 10000); + clearTimeout(timer); + await t.step("step", async () => { + await new Promise<void>((resolve) => setTimeout(() => resolve(), 10)); + }); + console.log("done"); +}); |
