Compare commits

...

1 Commits

Author SHA1 Message Date
Rizumu Ayaka
9d93fda3f1 test: add perf tests for workflow loading time
Add two @perf tests measuring workflow load + settling time:
- large workflow (245 nodes): measures DOM creation and layout cost
- media-heavy workflow (585 nodes + 128 media): measures combined
  node creation and media preview loading pressure

The media-heavy test intercepts /api/view requests with a small
test image to ensure deterministic media rendering cost.
2026-04-02 16:52:52 +08:00
2 changed files with 26719 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,7 @@
import { expect } from '@playwright/test'
import { comfyPageFixture as test } from '../fixtures/ComfyPage'
import { assetPath } from '../fixtures/utils/paths'
import { logMeasurement, recordMeasurement } from '../helpers/perfReporter'
test.describe('Performance', { tag: ['@perf'] }, () => {
@@ -348,6 +349,63 @@ test.describe('Performance', { tag: ['@perf'] }, () => {
})
})
test.describe('workflow loading', () => {
test('large workflow load and settle', async ({ comfyPage }) => {
await comfyPage.perf.startMeasuring()
await comfyPage.workflow.loadWorkflow('large-graph-workflow')
// Settling period: 120 frames (~2s) for DOM creation + layout stabilization
for (let i = 0; i < 120; i++) {
await comfyPage.nextFrame()
}
const m = await comfyPage.perf.stopMeasuring('large-workflow-load')
recordMeasurement(m)
logMeasurement('Large workflow load', m, [
'durationMs',
'styleRecalcs',
'layouts',
'taskDurationMs',
'totalBlockingTimeMs',
'domNodes',
'heapDeltaBytes'
])
})
test('media-heavy workflow load and settle', async ({ comfyPage }) => {
// Intercept all media preview requests with a small test image
await comfyPage.page.route(/\/api\/view\?/, (route) =>
route.fulfill({
path: assetPath('image64x64.webp'),
contentType: 'image/webp'
})
)
await comfyPage.perf.startMeasuring()
await comfyPage.workflow.loadWorkflow('profiling-workflow-media-heavy')
// Longer settling: 240 frames (~4s) for 585 nodes + 128 media previews
for (let i = 0; i < 240; i++) {
await comfyPage.nextFrame()
}
const m = await comfyPage.perf.stopMeasuring('media-heavy-workflow-load')
recordMeasurement(m)
logMeasurement('Media-heavy workflow load', m, [
'durationMs',
'styleRecalcs',
'layouts',
'taskDurationMs',
'totalBlockingTimeMs',
'frameDurationMs',
'domNodes',
'heapDeltaBytes'
])
})
})
test('workflow execution', async ({ comfyPage }) => {
// Uses lightweight PrimitiveString → PreviewAny workflow (no GPU needed)
await comfyPage.workflow.loadWorkflow('execution/partial_execution')