Skip to content

armgit / cra

Public Imported from GitHub
0

The open-source Arc replacement for macOS. Spaces, pinned tabs, split view, Little Windows and Arc's shortcuts on Chromium, with your Arc sidebar imported in one go.

Perf recorder test: the timer queues the block, so one pass doesn't depend on timer latency (#150)

Victor Kildahl4b11c9a8c9c1
diff --git a/Tests/PerfTests.swift b/Tests/PerfTests.swift
index 3c05987..7117059 100644
--- a/Tests/PerfTests.swift
+++ b/Tests/PerfTests.swift
@@ -260,13 +260,16 @@ enum PerfTests {
/// GitHub #135: a timer and a queued block that run in one turn of the loop, with no sleep
/// or commit between them, are one 300 ms pass. Split at before-timers they were two 150 ms
- /// halves and no stall at all.
+ /// halves and no stall at all. The timer queues the block: queued side by side, the block could
+ /// run first and the loop sleep before a late timer (a slow CI runner), two passes after all.
@MainActor static func workAcrossATimerBoundaryIsOnePass() {
start(config("one-pass"))
spin(0.5)
let before = report()?.mainThread.passes.count ?? 0
- Timer.scheduledTimer(withTimeInterval: 0, repeats: false) { _ in usleep(150_000) }
- DispatchQueue.main.async { usleep(150_000) }
+ Timer.scheduledTimer(withTimeInterval: 0, repeats: false) { _ in
+ usleep(150_000)
+ DispatchQueue.main.async { usleep(150_000) }
+ }
spin(0.6)
let r = report()
let stalls = r?.mainThread.recent ?? []