Skip to content

Commit 0649dbc

Browse files
author
15367279252qq.com
committed
test: replace parallel-faster-than-sequential assertion with regression guard
1 parent fb032ab commit 0649dbc

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

tests/smoke/perf/rendering-perf.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,15 @@ describe('perf: concurrency', () => {
228228
expect(p90(times)).toBeLessThan(4000)
229229
}, 60_000)
230230

231-
test('parallel is faster than sequential for 4 renders', async () => {
231+
test('4 parallel PNG renders do not regress vs sequential (p50 within 3×)', async () => {
232+
// On multi-core machines parallel is faster; on CI single-core runners it may be
233+
// similar or slightly slower due to context-switching. We only guard against a
234+
// dramatic regression (parallel taking > 3× sequential), not require improvement.
232235
const [seqTimes, parTimes] = await Promise.all([
233236
measure(async () => { for (let i = 0; i < 4; i++) await renderMarkdown(PLAIN_MD) }, 4),
234237
measure(() => Promise.all(Array.from({ length: 4 }, () => renderMarkdown(PLAIN_MD))).then(() => {}), 4),
235238
])
236-
expect(p50(parTimes)).toBeLessThan(p50(seqTimes))
239+
expect(p50(parTimes)).toBeLessThan(p50(seqTimes) * 3)
237240
}, 60_000)
238241
})
239242

0 commit comments

Comments
 (0)