GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(tui): keep the model picker responsive with large catalogs by neriousy · Pull Request #66370 · anomalyco/opencode

Conversation

@neriousy

@neriousy neriousy commented Nov 25, 2026

Copy link
Copy Markdown
Member

Issue for this PR

Closes #66326

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

the tui model picker got really slow with big catalogs (openrouter, kilo). there were 3 problems:

  • findModel in context/local.tsx was a linear scan, and the picker calls isSpeed (so findModel twice) for every model on every key. that's O(n²): ~190ms per key at 2k models. it's now a map lookup
  • dialog-model.tsx rebuilt every option object on every key. the model options are now a memo that doesn't depend on the query, so search returns the same objects. new designs no longer clones each result to swap the description and footer; they use searchDescription (new, next to the existing searchFooter) and searchFooter
  • DialogSelect rendered <For each={grouped()}>, and every update builds new [category, options] tuples, so every row got mounted again on every key. headers and rows are now one flat list keyed by identity, so rows that stay listed are kept, including when the list switches between grouped and flat

rows that a search removes still mount again when you widen the search, because <For> disposes them. that now costs about as much as opening the picker. no visual changes: frames before and after are identical with new designs on and off

no flag, it's a fix

How did you verify your code works?

timed opening the picker and typing gatewaya model 512 one key at a time (component render, 2 generated providers, the same setup as the repro in the issue):

models open first key whole query (18 keys)
2,000 before 300ms 405ms 5.7s
2,000 after 121ms 94ms 0.21s
6,000 before 2.6s 3.5s 53.7s
6,000 after 278ms 271ms 0.8s
6,000 after, new designs 349ms 185ms 0.73s
  • added keeps rows mounted while the filter changes to test/cli/tui/dialog-select.test.tsx. it fails on dev and passes 10 of 10 reruns here
  • full tui suite passes (1741 pass), bun typecheck clean

Screenshots / recordings

no visual change

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@neriousy
fix(tui): keep the model picker responsive with large catalogs
c8f20ad
@neriousy
neriousy merged commit ea8aa5b into dev Nov 25, 2026
11 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@neriousy
neriousy deleted the tui-model-search branch November 25, 2026 13:18
opencodejr[bot]
opencodejr Bot reviewed Nov 25, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I reproduced the lag on the base with the #66326 script (2 providers x 1,000 models, typing gatewaya model 512 one key at a time): each key took 0.9–1.8 s, about 25 s for the query. With this PR each key takes 21–357 ms, 1.9 s in total, and the picker opens in about half the time. The search results look the same before and after. The new test fails on the base and passes here, and the TUI tests (445) and tsc -b pass.

Public API is unchanged: searchDescription is a new optional field on the TUI-internal DialogSelectOption.

I didn't find anything blocking.

Before

After

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@LyleLiu666 LyleLiu666 mentioned this pull request Nov 25, 2026
fix(tui): keep model search responsive with large catalogs #66346
Open
3 of 6 tasks
@simonklee simonklee mentioned this pull request Nov 25, 2026
fix(cli-rs): bring the Rust client level with the TUI #66470
Merged
@amrkmn amrkmn mentioned this pull request Nov 26, 2026
opencode 2.4.2 amrkmn/homebrew-tap#1260
Closed
1 task
This was referenced Nov 26, 2026
feat: opencode release v2.4.2 sprisa/opencode-server#97
Merged
Tool release: OpenCode 2 v2.4.2 (was v2.3.2) agent-sh/agnix#1894
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@opencodejr opencodejr[bot] opencodejr[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Huge input lag/performance problems when searching model list in TUI

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@neriousy
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.