A 60ms Eye for the DOM — How linux-use Outran a Purpose-Built Browser Tool
I benchmarked my GUI automation tool against flashbrowse, a Rust CLI built specifically to feed web pages to agents. It should have won. It didn't — because its bottleneck wasn't the protocol, it was the tree.
The setup
linux-use drives Linux desktop apps through AT-SPI, the accessibility tree. Its superpower for browsers is the live, signed-in session — the thing headless tools structurally cannot touch. Its known weakness: Chromium only materializes accessibility nodes near the viewport, so a 300-row page exposed ~55 rows and find literally could not see widgets below the fold.
flashbrowse does the opposite: it spawns its own headless Chrome and fetches the complete accessibility tree over CDP in one shot. My original question was whether linux-use should just route web work to it. The answer turned into a three-week rabbit hole ending in a --via cdp flag that reads the whole DOM in ~60ms.
First fix: teach AT-SPI to scroll
Before touching CDP, I fixed the coverage gap with what the tree already offered. Chromium's document web node exposes scrollForward/scrollBackward accessible actions — one call scrolls a full viewport, works while occluded, no pointer. state --expand sweeps, merges each pass by ref path, and restores scroll: all 300 rows in 8 scrolls, ~6s. find "Action 295" --expand returns a real ref for a widget that wasn't in the tree at all. That works on the live signed-in browser — where no CDP tool can go — and that matters more than speed.
Then the insight that beat flashbrowse
Benchmarking flashbrowse, I noticed its own bottleneck wasn't the protocol — it was Accessibility.getFullAXTree plus its settle loop. On a 15,000-widget page it produced nothing for 90 seconds. So the CDP fast path I built doesn't fetch the AX tree at all: one Runtime.evaluate returns every interactive element as TSV — role, name, document coordinates, XPath. Refs are cdp<pid>:<xpath>#fingerprint, and act re-discovers the WebSocket endpoint from /proc/<pid>/cmdline and fires a real DOM .click() — no pointer, no focus, occluded window fine.
The whole client is ~200 lines of C inside the single binary: a blocking localhost WebSocket plus an HTTP GET. No dependencies, no TLS, localhost only.
The numbers
Same machine, sequential, idle. linux-use numbers are wall-clock (internal op time in parens); flashbrowse open includes spawning its own Chrome.
linux-use --via cdp flashbrowse open
300-row table (file://) 0.40s (58ms, 900 el) 1.2–1.5s (1200 actions)
MDN HTML reference 0.37s (64ms, 422 el) 2.7–4.7s (150 actions)
Wikipedia pop. list 0.48s (121ms, 1767 el) 5.1–9.4s (1954 actions)
3000-row table one DOM query >90s, no output
Warm act is the bigger gap: ~70ms vs ~850ms — flashbrowse re-fetches the whole AX tree to rebuild its action map on every action, while a cdp ref carries its own address (pid + xpath) and needs nothing else.
What this doesn't claim
- flashbrowse returns a semantic tree — compressed actions, text structure, markdown dumps, sessions, MCP server, stealth, resource policies. linux-use's CDP path returns interactive elements only; table cells and static text are still AT-SPI's job.
- The comparison is cold-path. A persistent MCP session amortizes flashbrowse's spawn cost — though its per-call action-map rebuild still costs ~850ms per
act. - Three pages is a claim, not a proof. Shadow DOM, iframes and ARIA-only widgets are untested.
The safety boundary is a feature
--via cdp only works on a browser launched with --remote-debugging-port — which Chromium refuses on the default profile. So the fast path is structurally impossible to aim at your live signed-in browser. That's not a limitation; it's the boundary that makes the feature safe to ship. The dedicated-profile launcher (contrib/a11y-browser A11Y_CDP_PORT=PORT) is the supported on-ramp, and AT-SPI stays the route for everything CDP can't see: browser chrome, dialogs, the rest of the desktop, and the live session itself.
The tools ended up complements, not competitors: flashbrowse for no-session scraping where its compressor shines, linux-use for anything involving a real desktop — now with a DOM eye fast enough that the old scroll-and-rewalk dance is the fallback, not the plan. Code: github.com/javimosch/linux-use.