Skip to content

Convert some sleep-heavy tests to synctest - #1406

Merged
brandur merged 1 commit into
masterfrom
brandur-synctest
Sep 30, 2026
Merged

brandur merged 1 commit into
masterfrom
brandur-synctest

Conversation

@brandur

@brandur brandur commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

I just happened to notice that the LLMs are starting to use synctest
in test cases, so I asked Codex to go back and try to convert any test
cases that look like low hanging fruit for synctest because they're
heavily reliant on sleeps. We get some nice individual speedups:

Test group Before After
Debounce 252.7 ms 0.8 ms
Notification limiter 200.8 ms 1.4 ms
Completion/shutdown 1,233.3 ms 0.9 ms
Periodic job registry 572.1 ms 1.9 ms
Cancellable sleep 52.6 ms 0.7 ms
Ticker 1.8 ms 0.8 ms

Everything runs in parallel so there's no meaningful speed up overall,
but it can't hurt to have some individual tests that get faster.

I just happened to notice that the LLMs are starting to use `synctest`
in test cases, so I asked Codex to go back and try to convert any test
cases that look like low hanging fruit for `synctest` because they're
heavily reliant on sleeps. We get some nice individual speedups:

| Test group | Before | After |
|---|---:|---:|
| Debounce | 252.7 ms | 0.8 ms |
| Notification limiter | 200.8 ms | 1.4 ms |
| Completion/shutdown | 1,233.3 ms | 0.9 ms |
| Periodic job registry | 572.1 ms | 1.9 ms |
| Cancellable sleep | 52.6 ms | 0.7 ms |
| Ticker | 1.8 ms | 0.8 ms |

Everything runs in parallel so there's no meaningful speed up overall,
but it can't hurt to have some individual tests that get faster.
@brandur
brandur requested a review from bgentry September 28, 2026 22:34
@brandur

brandur commented Sep 30, 2026

Copy link
Copy Markdown
Contributor Author

@bgentry Gonna merge this since it's test only and probably not harmful, but LMK if you have any objections.

@brandur
brandur merged commit 4598896 into master Sep 30, 2026
15 checks passed
@brandur
brandur deleted the brandur-synctest branch September 30, 2026 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant