Skip to content

test(react): add a browser benchmark for typing in menu search - #595

Draft
kianbazza wants to merge 1 commit into
ui-644-track-the-pointer-trail-only-while-a-submenu-trigger-isfrom
ui-650-add-a-browser-benchmark-for-typing-in-menu-search
Draft

kianbazza wants to merge 1 commit into
ui-644-track-the-pointer-trail-only-while-a-submenu-trigger-isfrom
ui-650-add-a-browser-benchmark-for-typing-in-menu-search

Conversation

@kianbazza

@kianbazza kianbazza commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

bun run bench:browser builds a menu with N rows in production mode, types into its Input in headless Chromium, and reports the time from each keydown to the next paint. It runs the same rows through the JSX API (DropdownMenu.Item children) and the data-first API (content + useDataList()).

packages/react/bench/menu-typing/
├── app.tsx   # open DropdownMenu, ?mode=jsx|data&rows=N
└── run.ts    # Bun.build (production React), Playwright, CDP CPU throttling

Each loop types and deletes label (every row stays visible, so the time is re-rendering) and then 123 (rows unmount and mount). The first 2 loops are warmup. Flags: --rows, --modes, --throttle, --loops, --per-key.

The run fails instead of reporting a misleading number when:

  • the bundle isn't production React
  • a key doesn't change the row count the way its phase expects, or the input doesn't hold the expected value after a phase
  • a row, its text, or a highlight attribute changes after the measured paint (work the measurement missed)

Evidence

No automated tests; it's a dev tool. Output on this branch, 1000 rows, 10 loops:

phase                    jsx 1×   data 1×   jsx 4×    data 4×   (p50, ms)
type, all rows match      7.5     13.4      10.8      36.0
delete, all rows match   10.0     11.2      10.4      34.8
type, list narrows       64.4     23.4     146.0      67.5
delete, list widens      61.0     49.0     199.8     188.2

--per-key shows where the time goes. The Backspace that brings 728 rows back takes 486 ms (jsx) and 573 ms (data) at 1×, and 1878 ms and 2175 ms at 4×. #596 fixes that.

The "all rows match" rows sit near one frame and move between ~13 and ~29 ms from run to run on the same code, so compare them back to back.

Merge Danger

Door: two-way

Blast Radius: none

Not part of the published package (files is dist). Adds a bench:browser script to @bazza-ui/react, named so turbo's bench task doesn't pick it up.

Closes UI-650

@vercel

vercel Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ui-canary Ready Ready Preview Oct 10, 2026 11:33pm UTC

Request Review

@linear-code

linear-code Bot commented Oct 10, 2026

Copy link
Copy Markdown

UI-650

@kianbazza
kianbazza force-pushed the ui-650-add-a-browser-benchmark-for-typing-in-menu-search branch from 0febfe7 to 8eae3cb Compare October 10, 2026 23:33

This branch was successfully deployed

1 active deployment
Preview – ui-canary — 8eae3cbb Deployed Oct 10, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant