Document forks; time moving between forks on the large library

Four forks of the library pane, each three panes deep, on over 5,000 nodes:
[ and ] keep to the panes budget.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014yB6q4BHMwptTX3YFtkRab
This commit is contained in:
thalladaandClaude Opus 5.5 committed 2026-11-15 22:48:10 -05:00
1 parent 207002410b
commit 2f8ca98207
2 files changed
+47 -5

No files matched your search

+22 -1
View File
@@ -78,6 +78,26 @@ Press `?` for every key. The short version:
notes: the library, the open document, its open sections. Following a link opens its target in
the next pane; moving back left with `h` closes nothing; `q` closes panes. `v` switches between
panes and the single column, `/view auto|column|panes` sets it.
- **Forks.** To go two ways from one pane, open the second with `Shift+Enter` (or a Shift-, Ctrl- or
Cmd-click, or a middle click) on a row, a link, a link in an article, or a "Linked from",
"Mentioned in" or Related row: it opens beside what is to the right instead of replacing it, and
the space right of the pane divides into rows, one per fork, top to bottom in the order they were
opened. Each fork goes on to the right on its own and can fork again. Rows share the height down
to a third of it each; with more, the rows scroll down (the pane they came from stays at the top),
keeping the focused one in view. Sideways the whole strip scrolls as one, so a fork always sits in
the column next to the pane it came from. That pane marks every fork's row, link or words, the
focused fork's as before and the others lightly. A plain `Enter` or click works as it always has:
it replaces the focused fork (or, on something already open as a fork of that pane, focuses it);
with nothing open to the right, a fork is a plain open.
`[` and `]` move to the fork above and below (in the order the rows are drawn, the nearest first),
back where you were in it or to its pane nearest your column; a click anywhere in a fork does the
same. `h` and `l` move along the focused fork, as along a trail. `q` closes the panes right of the
one being read, every fork among them; with none, it closes that pane and steps left, and in a fork
that means the whole fork, from where it branched to its end. With one fork left the panes are a
plain trail again. The forks are kept with the rest of the view, so a reload brings them back; the
address names the focused pane only. On a window too short or narrow for rows only the focused fork
is drawn, and its first pane says which fork of how many it is. The column has one page: there a
modified open is a plain one.
### Links and Wikipedia
@@ -190,7 +210,8 @@ What is sent where:
`wikiRoutes.ts`, `wikiMock.ts`), local embeddings (`embed.ts`), link discovery (`links/`), and
migrates data from older layouts (`migrate.ts`).
- **`src/ui/`** The browser's replica of the library (`session.ts`, kept in IndexedDB), the store
and keymap, and the page.
and keymap, and the page. The panes view's panes are a tree of forks (`forks.ts`, pure functions;
the store's `trail` is its focused branch).
## The library
+25 -4
View File
@@ -1,11 +1,12 @@
/**
* A large library in the browser: 100 more documents of 50 nodes each (over 5,000 nodes in all),
* written over the op API. Keypress → paint is measured as in the other specs, while moving
* through the library page, inside documents and across them, in the column and in panes; a body
* edit is timed from the store call to the painted frame. Runs last: it fills the shared library.
* through the library page, inside documents and across them, in the column and in panes, and
* between four forks of the library pane, each three panes deep; a body edit is timed from the
* store call to the painted frame. Runs last: it fills the shared library.
*/
import { expect, test, type Page } from "@playwright/test";
import { state, synced, writeReport, type Sample } from "./helpers";
import { idle, state, synced, writeReport, type Sample } from "./helpers";
const ready = (page: Page) => page.waitForFunction(() => (globalThis as any).__ie?.ready === true, undefined, { timeout: 30_000 });
/** One keystroke per frame, as in the other latency tests. */
@@ -104,18 +105,38 @@ test("a library of over 5,000 nodes in 100 more documents: keypress → paint an
for (let i = 0; i < 40; i++) await paced(page, "j");
for (let i = 0; i < 6; i++) await paced(page, "l l l j l i j Escape h h h j");
const panes = stats(await keySamples(page));
// ---- forks: four documents opened side by side from the library pane, each three panes deep (document, part, leaf) ----
await page.goto("/doc/scale-document-90");
await ready(page);
await paced(page, "l l l l");
for (let d = 1; d < 4; d++) await paced(page, "h h j Shift+Enter l l l l");
await idle(page);
// The twelve panes' Related lists are fetched as they are first drawn: let them arrive, so what is timed is moving between forks.
await page.waitForTimeout(1000);
const depths = await state(page, (s) => s.tree.kids.map((k: any) => {
let depth = 0;
for (let n = k; n; n = n.kids[n.pick]) depth++;
return depth;
}));
expect(depths).toEqual([3, 3, 3, 3]);
await page.evaluate(() => ((globalThis as any).__ie.samples.length = 0));
for (let i = 0; i < 8; i++) await paced(page, "[ [ [ ] ] ]");
const forks = stats(await keySamples(page));
await page.goto("/doc/scale-document-98");
await ready(page);
await paced(page, "l l j");
const panesEdit = stats(await editTimes(page, 15));
const report = { nodes, documents: await state(page, (s) => s.snap.nodes[s.snap.root].children.length), writtenMs: written, bootFreshMs: bootFresh, bootStoredMs: bootStored, column, columnEdit, panes, panesEdit };
const report = { nodes, documents: await state(page, (s) => s.snap.nodes[s.snap.root].children.length), writtenMs: written, bootFreshMs: bootFresh, bootStoredMs: bootStored, column, columnEdit, panes, panesEdit, forks };
console.log("large library:", JSON.stringify(report));
writeReport("scale", report);
for (const r of [column, panes]) {
expect(r.n).toBeGreaterThan(80);
expect(r.p95).toBeLessThan(50);
}
expect(forks.n).toBeGreaterThanOrEqual(40);
expect(forks.p95).toBeLessThan(50);
for (const r of [columnEdit, panesEdit]) expect(r.median).toBeLessThan(50);
expect(bootStored).toBeLessThan(10_000);
});