Improve template search input performance issue #8343
Improve template search input performance issue #8343AustinMroz merged 3 commits intoComfy-Org:mainfrom
Conversation
📝 WalkthroughWalkthroughSwap throttle for debounce in template filtering composable (debounce delay changed 50→150), and change pagination reset watcher in the workflow template selector to depend on filteredTemplates instead of searchQuery. Changes
Possibly related PRs
Suggested reviewers
✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🎭 Playwright Tests: ✅ PassedResults: 507 passed, 0 failed, 0 flaky, 8 skipped (Total: 515) 📊 Browser Reports
|
|
@kaili-yang That was the opposite of my experience 🙃 When I tested it the search resolved a lot faster using throttled. @AustinMroz ? |
Bundle Size ReportSummary
Category Glance Per-category breakdownApp Entry Points — 26 kB (baseline 26 kB) • ⚪ 0 BMain entry bundles and manifests
Status: 1 added / 1 removed Graph Workspace — 974 kB (baseline 974 kB) • 🟢 -16 BGraph editor runtime, canvas, workflow orchestration
Status: 1 added / 1 removed Views & Navigation — 80.7 kB (baseline 80.7 kB) • ⚪ 0 BTop-level views, pages, and routed surfaces
Status: 11 added / 11 removed Panels & Settings — 471 kB (baseline 471 kB) • 🟢 -101 BConfiguration panels, inspectors, and settings screens
Status: 12 added / 12 removed User & Accounts — 3.94 kB (baseline 3.94 kB) • ⚪ 0 BAuthentication, profile, and account management bundles
Status: 3 added / 3 removed Editors & Dialogs — 2.89 kB (baseline 2.89 kB) • ⚪ 0 BModals, dialogs, drawers, and in-app editors
Status: 2 added / 2 removed UI Components — 33.7 kB (baseline 33.7 kB) • ⚪ 0 BReusable component library chunks
Status: 8 added / 8 removed Data & Services — 2.7 MB (baseline 2.71 MB) • 🟢 -4.54 kBStores, services, APIs, and repositories
Status: 8 added / 8 removed Utilities & Hooks — 25.3 kB (baseline 25.3 kB) • ⚪ 0 BHelpers, composables, and utility bundles
Status: 10 added / 10 removed Vendor & Third-Party — 10.7 MB (baseline 10.7 MB) • 🟢 -327 BExternal libraries and shared vendor chunks
Status: 1 added / 1 removed Other — 7.1 MB (baseline 7.1 MB) • 🟢 -2.76 kBBundles that do not match a named category
Status: 49 added / 49 removed |
|
Conceptually, I think the template search should use be a debounce and have a higher delay (100-150). But 50ms throttled feels much better than 50ms debounced and appears to be better than the proposed 300ms debounced of this PR, too. I went ahead and did some digging myself since the circumstances were frustrating to me. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/composables/useTemplateFiltering.ts`:
- Line 1: Replace the broken refThrottled usage by creating a debounced search
ref and using a 300ms delay: import refDebounced from '@vueuse/core' (or add
refDebounced to the existing import) and replace the refThrottled(searchQuery,
50) call with refDebounced(searchQuery, 300); then update
WorkflowTemplateSelectorDialog.vue so its watcher listens to the debounced
search ref (or uses the same 300ms debounced value) instead of the raw
searchQuery to avoid calling resetPagination() and incrementing
templateListKey.value++ on every keystroke — keep references to the symbols
searchQuery, refDebounced/refThrottled, resetPagination, and templateListKey
when making these changes.
|
The performance issue was NOT the search algo, but the UI Watcher on |
## Summary Improve Template search input performance issue #8134 This was caused by the search logic running too frequently (throttled at 50ms), causing the main thread to block on every few keystrokes. ## Changes Use debouncing that wait until you stop typing for a specific time (300ms) before running. It makes the searching function more smoothly. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8343-Improve-template-search-input-performance-issue-2f56d73d36508144bdf9fa5e0cd76818) by [Unito](https://www.unito.io) --------- Co-authored-by: Alexander Brown <drjkl@comfy.org>
## Summary Improve Template search input performance issue #8134 This was caused by the search logic running too frequently (throttled at 50ms), causing the main thread to block on every few keystrokes. ## Changes Use debouncing that wait until you stop typing for a specific time (300ms) before running. It makes the searching function more smoothly. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8343-Improve-template-search-input-performance-issue-2f56d73d36508144bdf9fa5e0cd76818) by [Unito](https://www.unito.io) --------- Co-authored-by: Alexander Brown <drjkl@comfy.org>
|
@kaili-yang Successfully backported to #8471 |
|
@kaili-yang Successfully backported to #8472 |
…#8472) Backport of #8343 to `cloud/1.38` Automatically created by backport workflow. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8472-backport-cloud-1-38-Improve-template-search-input-performance-issue-2f86d73d3650815ba8dfef1ea135c4a3) by [Unito](https://www.unito.io) Co-authored-by: Kelly Yang <124ykl@gmail.com> Co-authored-by: Alexander Brown <drjkl@comfy.org>
…8471) Backport of #8343 to `core/1.38` Automatically created by backport workflow. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8471-backport-core-1-38-Improve-template-search-input-performance-issue-2f86d73d365081e3afbff8779ea0ebe0) by [Unito](https://www.unito.io) Co-authored-by: Kelly Yang <124ykl@gmail.com> Co-authored-by: Alexander Brown <drjkl@comfy.org>
## Summary Improve Template search input performance issue #8134 This was caused by the search logic running too frequently (throttled at 50ms), causing the main thread to block on every few keystrokes. ## Changes Use debouncing that wait until you stop typing for a specific time (300ms) before running. It makes the searching function more smoothly. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8343-Improve-template-search-input-performance-issue-2f56d73d36508144bdf9fa5e0cd76818) by [Unito](https://www.unito.io) --------- Co-authored-by: Alexander Brown <drjkl@comfy.org>
## Summary Improve Template search input performance issue #8134 This was caused by the search logic running too frequently (throttled at 50ms), causing the main thread to block on every few keystrokes. ## Changes Use debouncing that wait until you stop typing for a specific time (300ms) before running. It makes the searching function more smoothly. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8343-Improve-template-search-input-performance-issue-2f56d73d36508144bdf9fa5e0cd76818) by [Unito](https://www.unito.io) --------- Co-authored-by: Alexander Brown <drjkl@comfy.org>


Summary
Improve Template search input performance issue #8134
This was caused by the search logic running too frequently (throttled at 50ms), causing the main thread to block on every few keystrokes.
Changes
Use debouncing that wait until you stop typing for a specific time (300ms) before running.
It makes the searching function more smoothly.
┆Issue is synchronized with this Notion page by Unito