Outliner

Speed

The numbers come from tools/perf.tcl. The script runs inside the app with the headless backend of ztk, on a graph that tools/gen-graph.tcl makes.

The headless backend renders each frame on the CPU. A window on Wayland, macOS, or Windows renders with the GPU, so the frame times below are an upper limit.

Open a graph

StepTime
Open with the index cache: list the files, read the cache555 ms
Show the journals after the open45 ms
Open with no cache: list the files and the names337 ms
First index of all files (in the background, the window is in use)1,960 ms
Write the index cache45 ms
Load the search text (in the background)3,265 ms

The window shows the journals about 0.6 s after the start with a cache, and about 0.4 s after the start on the first open. The first index runs in steps of 150 files between frames.

Edit

StepTime
Show a page17 to 32 ms
Start the editor on a block6.7 ms
Type one character, the script0.53 ms
Type one character, with the rendered frame6.2 ms
Write the typed text to the graph13 ms
New block (Enter), with the frame16 ms
Indent (Tab), with the frame16 ms
Undo, with the frame16 ms
Save the file15 ms
Scroll one frame of a long journal view11.5 ms

A frame at 60 frames in a second has 16.7 ms. Typing and scrolling stay inside one frame with the CPU renderer.

Search and queries

StepTime
Search, one word43 ms
Search, two words61 ms
Search, a page name63 ms
Backlinks of a page0.5 ms
Simple query (and [[Page 7]] (task TODO))16 ms
Simple query (task TODO) on the whole graph, first run (it parses 8,000 files)3,328 ms
The same query, second run (7,152 results)638 ms
Advanced query: marker and journal day, on the whole graph1,813 ms

A query with a page reference reads only the files that reference the page. A task query reads only the files with the marker, from the index. A query on the whole graph parses each file one time and keeps the blocks.

Plugins

From tests/t-plugin.tcl:

StepTime
Start a Tcl plugin (a new safe interpreter and its script)0.66 ms
One call of a Tcl plugin: request, grant check, log entry, answer0.13 ms
Start a WebAssembly plugin (decode, validate, instantiate, init)0.99 ms
One command of a WebAssembly plugin with 4 host calls0.36 ms
One line of the hash chain (SHA-256 in Tcl, 200 bytes)0.28 ms

The hash chain is made when the log goes to the file, not at each call.

The web version

From tools/build-web.sh and tools/web-check.mjs, with the web build of ztk at the pin and headless Chromium on the same host:

FileSizegzip -9brotli -q 11
ztk.wasm (ztcl, ztk, the fonts, the CPU renderer)7,549,935 bytes2,361,222 bytes1,603,871 bytes
app.tcl (the scripts of Outliner)321 kB76 kB64 kB
StepTime
From the navigation to the demo graph on the screen, files from the local server0.5 to 0.6 s

The page shows a progress bar while it loads ztk.wasm. GitHub Pages sends the files with gzip.

Run the measurement

ztk --headless --allow clock tools/gen-graph.tcl /tmp/big 10000 730
ztk --headless --allow clock,random,interp,package,env,event src/main.tcl --run $PWD/tools/perf.tcl /tmp/big

Known slow paths