Skip to content

perf: reduce model picker work while searching - #189949

Merged
steipete merged 5 commits into
mainfrom
solid2/w-perf-lowend-picker-range
Nov 1, 2026
Merged

steipete merged 5 commits into
mainfrom
solid2/w-perf-lowend-picker-range

Conversation

@steipete

@steipete steipete commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Opening and searching a large model catalog repeatedly scans every model to select its few mounted rows. Reuse the prepared catalog index and virtualizer keys for large contiguous lead/More lists; small lists keep their existing filter. An equality-bearing keys memo prevents geometry-only updates from repeating selection. The 1,000-model mobile fixture keeps the same catalog order, keyed focus, shortcuts and visible choices. No domain owner, native row-measurement policy, lazy boundary, dependency or new cache changes.

Source-mapped counts: membership checks fall 5,973→54 first-open/search and 4,964→36 warm. Added mounted-key lookups are 81/60 and key-projection items 302/261. Row creation, uncached geometry reads and size corrections remain 45/34; window publications remain 65/51. Small-list helper calls rise 9→16 / 6→10; timings include that cost.

Evidence

Times are milliseconds, median / nearest-rank p95. Each triplet is counterbalanced base/head/base on one host; all observations and A/A controls are retained. Chromium is mobile 390×844/touch with 128 MiB V8 old-space, thread-CPU task metrics and whole-renderer CPU. This is not physical Android OS memory-pressure proof. WebKit reports application/wall elapsed time, never CPU.

Flow / metric Base median / p95 Head median / p95 Median change
Chromium 6× first-open/search task · 40 triplets 635.48 / 764.08 599.21 / 743.90 -5.71%
Chromium 6× warm open/search task · 20 triplets 549.64 / 729.29 528.54 / 678.99 -3.84%
Chromium 1× first-open/search · 20 triplets 79.71 / 82.88 74.57 / 79.12 -6.45%
Chromium 1× warm open/search · 20 triplets 61.06 / 63.91 57.67 / 59.68 -5.56%
Chromium 4× first-open/search · 20 triplets 371.38 / 439.18 336.83 / 392.35 -9.30%
Chromium 4× warm open/search · 20 triplets 281.64 / 302.80 242.04 / 264.71 -14.06%
WebKit application first-open/search · 20 triplets 153.00 / 158.00 146.00 / 159.00 -4.58%
WebKit application warm open/search · 20 triplets 107.00 / 114.00 103.50 / 115.00 -3.27%

The refreshed 6× source cohort is ebf13610e1b8b29462c68eb71e18450effe6fdc7 → 536f23ac8b4f628fa688734da4ce559dbcc98a01: 180/180 observations pass. The fresh 1×/4×/WebKit cohort is 72cab24990b3746574ac83e3d73c79530b8cc198 → c97c988aa23605a902d7f003a57fee39d84f3c38: 360/360 pass. The transition between these cohorts includes broader main changes; the measured picker UI and action sources are unchanged. The cohorts retain separate source pins. The final merge includes the landed drawer/image/Systems work and #190033; timings retain their exact source identities rather than being relabelled as final-head timings. The range patch and its three files are byte-identical throughout.

First-open/search clears the ≥5% 6× task threshold (−5.71%) with script −14.63% and renderer CPU median −4.56%. Warm's refreshed 6× gain is 3.84%, not separately claimed as ≥5%. First-open ready time improves 290.55/350.3→284.75/342.5 ms in the pooled 6× cohort. The 300 ms target remains unmet; no unavoidable floor is claimed.

Accepted tradeoffs and measurement limits

This is an aggregate flow win, not an all-metrics improvement. In the refreshed 6× cohort, first-open renderer CPU p95 +0.46% and wall p95 +0.47% are below the campaign's 1% noise threshold; the initial CPU-tail concern (+15.06%) was tested with 20 additional triplets rather than omitted. Layout median/p95 +3.13%/+4.83% and style median +3.16% remain disclosed (style p95 −6.17%).

At fresh 1×, all task/CPU/wall medians and p95s improve. First-ready median rises 70.2→74.4 ms (+5.98%) while its control is 75.2 ms; p95 rises 0.1 ms, and paired median is −0.69%. Warm style/layout p95 rises 0.281/0.273 ms. Warm heap-after p95 rises 1,263,908 B (+3.88%).

At fresh 4×, task/CPU/wall and first-ready medians/p95s improve. First layout p95 rises 3.128 ms (+6.55%; paired p95 +15.96%, A/A +12.33%). Warm net-heap delta median rises 998,236 B (+106.74%); this remains an adverse raw result. The observations have low/negative and ~1.9 MB net-change clusters (10/20 low or negative controls versus 5/20 candidate), so signed paired percentages cannot establish allocation savings. No GC trace proves its cause. Warm heap-after median/p95 changes +1.69%/−0.49%; RSS −0.17%/+0.28%. These bounded endpoint costs are accepted with the measured aggregate win; no all-memory-green or leak-free claim.

At WebKit, application p95 rises 1 ms in each flow (+0.63%/+0.88%); first wall p95 rises 0.35 ms (+0.15%), all below the sub-1% band. First assertion-tail median/p95 rises 7/10→8.5/11 ms (+21.43%/+10%). Its boundary is the last MutationObserver/native-value commit to scenario end, including visibility assertions and a browser evaluation round trip; it is neither CPU nor paint latency. Full first-native-input→scenario-end improves 159/168→155.5/167 ms, and last-input→last-mutation improves 2→1 ms (p95 stays 2). Last-input→scenario-end is 9→10 ms with 12 ms p95 unchanged. Warm last-input→last-mutation p95 is 3→4 ms (the control is also 4 ms), while final-input completion p95 remains 11 ms. WebKit first-open readiness improves 90/92→88/91 ms. An earlier commit mechanically lengthens the measured tail, but its full cause is not proved; this is not described as a harness-only interval or an all-final-key-latency win.

A separate final-head WebKit diagnostic (one base/head/base triplet per first/warm flow, 6/6 pass, trace overhead included) confirms a mixed rendering/protocol tail. First-open head has one post-mutation style pass and three short layout records, matching controls; tail ScriptProfiler elapsed union is 0.715 ms versus 1.143/0.692 ms, not CPU. Its sampled paint is later (+7.24 ms versus +4.76/+5.81 ms from the final native input). First-phase recording adds its own calls, so diagnostic timings are not pooled with or used to replace untraced results. The small final-key/paint uncertainty is accepted with improving whole-action metrics; no pure-harness or universal-latency claim.

The independent evidence review verifies source maps, all captured asset hashes, result hashes and arithmetic. No failed/slow observations are excluded.

Validation and size

The existing focused checks pass on the identical range implementation: 8 unit tests, 18 Chromium browser tests and 18 WebKit browser tests. Full exact-head PR CI is required after this update. The previous profile-page failure was not attributed inherited: #190033 fixed the unconfigured-channel runtime load, and its exact-head full CI passed before merging.

Previous exact-head byte/static checks: pnpm tsgo:ui and production pnpm deadcode:knip pass. Both exact source builds and strict checks pass on base c2a39e4c5a8166d1f5ea6703d1dfaa7d7c45de79 and head a5611941f0379b5d96b18ba25a64ead45c5dad72: startup JS 89,596→89,607 B gzip (+11 B, within the 64 B build-variance allowance); startup CSS 34,184→34,184 B, one request; Chat JS 1,273,453→1,273,290 B; New JS 782,206→781,793 B. No budget exception or new ignore.

Production LOC 807→830; browser test 457→465; full own diff +33/−2. The extra code reuses the existing index and preserves small-list behavior. Solid refactor census: createMemo 21→22; other imperative API counts unchanged. Independent P0–P2 code review is scoped-clean; the final range patch hash is b958cbf87cbfb3c51bdddea06d3bf64f7d224781da1af8360a744834910a0cce.

Reproduce with scripts/bench-control-ui-interactions.ts --steps model-picker-first-open-search,model-picker-open-search --viewport mobile --pairs 20 --counterbalance --cpu-throttle 6 --low-memory --thread-cpu-time --renderer-process-metrics, frozen base/head/base bundles; repeat at rates 1 and 4. WebKit uses scripts/bench-control-ui-engines.ts --engines webkit --network-profiles localhost --viewport mobile --pairs 20 with the same steps/bundles. Counts are separate --function-counts runs.

Visual proof

Inspected synthetic captures are pixel-identical. Host tags, classes and selectors are unchanged.

Before After
Model picker before Model picker after

Release-note context: less repeated work when opening and searching a large model catalog on slower devices.

Current integration

Merged main at c2bbb1059f85c3fe542e1f6620dea0e6bd4f18b2, including the independent browser-boundary repair #190089. Current head is 23ad064b71498c0b56c510895150f973c4b9e6a5; the complete three-file picker diff retains SHA-256 b958cbf87cbfb3c51bdddea06d3bf64f7d224781da1af8360a744834910a0cce. Earlier timing, byte and review evidence retains its stated source pins. Current-head UI types and production Knip pass. Both production builds and the strict base/head comparison pass: startup JS 90,271→90,270 B gzip, startup CSS 34,188→34,188 B / one request, Chat JS 1,274,111→1,273,661 B, New JS 782,441→782,054 B. Neither build has budget violations. Exact-head full CI 41277424144 passed. Native confirmed-cancelled replacement recovery merged this head as 076b925; the receipt and native cleanup are complete.

Final landed-source 6× snapshot

After landing, the retained production bundle from 23ad064b71498c0b56c510895150f973c4b9e6a5 (UI sources match merge 076b9257b799af025ccc8474e336caf53703dfc5) passed all 140 observations in ten counterbalanced A/A pairs across the seven scoped flows. Mobile/touch, headless Chromium6×, 128MiB V8 old-space; host load7.16–13.56. This is an absolute snapshot, not another improvement claim.

Flow Task median / p95 ms Max CLS Paired A/A task median Δ
chat-typing 520.63 / 612.13 0.00787147 +2.58%
session-switch 1590.62 / 1716.83 0.00000000 +0.25%
settings-open 540.04 / 624.14 0.00000000 -2.32%
settings-sections 828.98 / 891.16 0.00000000 +0.66%
model-picker-first-open-search 566.94 / 627.18 0.00000000 +3.24%
model-picker-open-search 429.68 / 473.38 0.00000000 +6.26%
sidebar-toggle 461.51 / 504.52 0.00000000 -0.68%

All seven task medians remain above300ms. Warm picker A/A median+6.26% is outside the5% timing band; do not use this snapshot for a new gain claim. The paired acceptance results above remain separately pinned. A V8 heap limit does not reproduce Android OS memory pressure.

@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Nov 1, 2026
@clawsweeper

clawsweeper Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T05:35:47.521713Z 23ad064 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@steipete
steipete enabled auto-merge (squash) November 1, 2026 01:55
@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 1, 2026
@clawsweeper

clawsweeper Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR selects mounted model choices using the existing catalog index instead of repeatedly scanning large provider lists.

Example: Open and search a 1,000-model catalog on the supplied mobile Chromium 6× fixture.

  • Before: Reported first-open/search task median is 608.06 ms.
  • After: Reported median is 567.76 ms, with identical captured output.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused implementation with concrete production-renderer evidence and no identified defect; broad CI failures remain unattributed.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Exact-base/head production Control UI bundles exercise first and warm opening/searching with 1,000 models on mobile Chromium and WebKit; reported task medians improve, and inspected before/after screenshots are byte-identical.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Opening and searching large model catalogs takes noticeable time on slower devices.
Reason: The maintainer-authored direction has measured value, preserves the existing interaction contract, and explicitly accepts the disclosed performance tradeoffs.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR makes a focused, measured performance improvement, and review found no actionable code or security defect.

Priority: P2
Reviewed head: 132387b1ea832a4273f73e8f4e8e7f12b6aa58bb

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The added catalog-reorder assertions are not shown failing on the base; no additional shipped-entry-point proof gap was identified.
Agent review details

How this fits together

The Control UI model picker combines catalog choices and search state with virtualizer membership to render visible rows and pinned keyboard choices.

flowchart LR
Catalog[Model catalog] --> Prepared[Prepared groups and index]
Search[Search and disclosure] --> Layout[Ordered visible row keys]
Prepared --> Layout
Layout --> Window[Existing virtualizer]
Window --> Mounted[Mounted model selection]
Prepared --> Mounted
Mounted --> UI[Picker rows]
Loading

Technical review

Best possible solution:

Retain this focused optimization using the prepared catalog index and existing virtualizer while preserving selection, ordering, and row identity.

Do we have a high-confidence way to reproduce the issue?

Current-main source scans each complete provider list for mounted membership, and the supplied exact-revision measurements exercise that cost through the production picker; no target code was run during review.

Is this the best way to solve the issue?

The change removes unnecessary membership work using existing indexes, preserves contiguous-list order, and filters geometry-only invalidations without adding another state owner.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 418bb925ca47.

Provenance checked

  • Mounted model membership and virtualization keeps the original intent (b968958: Mount only viewport, highlighted, and shortcut rows while retaining existing search and selection ownership.)
  • Reactive virtual-row projection keeps the original intent (3484041: Avoid invalidating unchanged row consumers when aggregate virtual geometry changes.)
  • Existing browser scenario keeps the original intent (test: remove low-value tests (batch d315) #178340: Consolidate repetitive test scaffolding while retaining distinct behavioral assertions.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 3484041 adds ui/src/pages/chat/components/chat-model-picker-window.tsx:69 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 3484041380f3; files: ui/src/pages/chat/components/chat-model-picker-window.tsx)

PR surface

Source +23, Tests +8. Total +31 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 25 2 +23
Tests 1 8 0 +8
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 33 2 +31

Review metrics

Metric Value Why it matters
Production versus test growth Production +23 net LOC; tests +8 LOC The bounded selection algorithm and equality memo reuse existing owners; test growth extends an existing focus-and-refresh scenario without new scaffolding.

Labels

Label changes:

  • add P2: Measured improvement to large-catalog picker responsiveness with limited scope and no established urgent regression.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Measured improvement to large-catalog picker responsiveness with limited scope and no established urgent regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Determine whether the failed sidebar and session E2E assertions also fail on the base before assigning repair work.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 31, 2026, 10:03 PM ET / November 1, 2026, 02:03 UTC.

@steipete
steipete disabled auto-merge November 1, 2026 02:12
@steipete
steipete merged commit 076b925 into main Nov 1, 2026
91 of 94 checks passed
@steipete
steipete deleted the solid2/w-perf-lowend-picker-range branch November 1, 2026 05:46
@steipete

steipete commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui ci:full Keep ordinary native-locale CI selection on the next PR run. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant