Repository navigation
Keep VS Code responsive during data browser sorts, filters and copies (Phase 1a) - #336
Merged
Merged
Conversation
Contributor
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. Next included review available in 52 minutes. View limit details
Comment |
jbearak
force-pushed
the
data-browser-phase-1a
branch
from
October 31, 2026 02:14
a38cba6 to
6a2665b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Every sort, filter, histogram and copy in Sight's data browser ran on the extension host's event loop, so VS Code froze for the whole operation. On a 10M-row file, a string sort blocked the editor for 14.8 s, and a slow regex filter for 29 s. A catastrophic regex never finished, and the only way out was killing the window. This is Phase 1a of the redesign planned in #333: all of that work now runs in worker threads, the editor stays responsive, and slow work can be cancelled.
What changes for users
rowsStale), and the grid asks again. Before, the page stayed blank until the next sort or filter finished.~/.sight/browse/until their panel closes, because the workers reopen them by path (dta-parser 0.6 can't share a descriptor). A<uuid>.leasebeside each one, refreshed while the panel is open, keeps other windows' 24-hour cleanup from deleting it. The panel deletes its own file when it closes.How.
compute-jobs.tsholds the job logic, unchanged algorithms lifted out ofbrowser-panel.ts.compute-worker.tsruns one job per worker, bundled asdist/data-browser-worker.js.compute-runner.tsmanages two pools (two slots for sorts and filters, two for copies and histograms) and cancels byterminate(). Without the bundle (unit tests, an unbuilt checkout) the same jobs run in-process. The panel's existing restore and action-queue state machine is kept. The spec's 1a row described more machinery: a cooperative scan worker, per-filter steps,order_epochon the wire. "Phase 1a as built" at the end of the spec records what shipped instead, and which phase picks up the rest.Benchmark (M4 Max, Node 26, warm cache, full-scale fixtures; host blocked = the host's longest event-loop stall)
Wall times are unchanged, since these are the same algorithms on the same reader. Peak RSS stays within 1a's budget: 979 MiB for the narrow sort (961 before), and 2,413 MiB for the wide strL filter (budget ≤ 2.5 GiB until 1b). Page reads still run on the host, so the wide file's first 5 MB page still stalls for about 620 ms; Phase 1b moves those reads off the host.
Checks.
bun run check:line-endings,bun run typecheckandbun run lintpass.bun test ./tests: 8,009 pass, plus the 2 help-coverage tests that need a local Stata install (failing the same way onmain). New tests cover: a real worker computing the same order as in-process; a stuck regex stopped within 250 ms; the deadline; a changed file; pool limits; dispose; Cancel dropping queued work; a newer sort superseding a running one;rowsStale; the pinned copy order; closing mid-refresh; the lease and the sweep.Proof: in a downloaded VS Code 1.123.0, the bundled worker ran inside the extension host. It sorted 10M rows in 3.5 s, filtered them in 0.4 s, and was terminated 505 ms into a catastrophic regex.
bun run test:perfpasses there too (narrow first rows painted at 404 ms, wide at 296 ms, 10% scale). The full benchmark above was run on this branch.Reviewed with sol-loop: 3 rounds with gpt-6.1-sol. Sol verdict: approved
Created with Claude Opus 5.5 in Claude Code.