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.
- Graph: 10,730 pages (10,000 pages and 730 journals), 42 MB of Markdown, about 230,000 blocks.
- Host: Intel Core i7-6700K, 8 threads, Linux, shared with other work.
- Program: ztk at the pin of
deps.lock, built with-Doptimize=ReleaseFast. - Date: 2026-11-27. The values are from one run. They change by about 20% from run to run on this host.
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
| Step | Time |
|---|---|
| Open with the index cache: list the files, read the cache | 555 ms |
| Show the journals after the open | 45 ms |
| Open with no cache: list the files and the names | 337 ms |
| First index of all files (in the background, the window is in use) | 1,960 ms |
| Write the index cache | 45 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
| Step | Time |
|---|---|
| Show a page | 17 to 32 ms |
| Start the editor on a block | 6.7 ms |
| Type one character, the script | 0.53 ms |
| Type one character, with the rendered frame | 6.2 ms |
| Write the typed text to the graph | 13 ms |
| New block (Enter), with the frame | 16 ms |
| Indent (Tab), with the frame | 16 ms |
| Undo, with the frame | 16 ms |
| Save the file | 15 ms |
| Scroll one frame of a long journal view | 11.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
| Step | Time |
|---|---|
| Search, one word | 43 ms |
| Search, two words | 61 ms |
| Search, a page name | 63 ms |
| Backlinks of a page | 0.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 graph | 1,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:
| Step | Time |
|---|---|
| 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, answer | 0.13 ms |
Start a WebAssembly plugin (decode, validate, instantiate, init) | 0.99 ms |
| One command of a WebAssembly plugin with 4 host calls | 0.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:
| File | Size | gzip -9 | brotli -q 11 |
|---|---|---|---|
ztk.wasm (ztcl, ztk, the fonts, the CPU renderer) | 7,549,935 bytes | 2,361,222 bytes | 1,603,871 bytes |
app.tcl (the scripts of Outliner) | 321 kB | 76 kB | 64 kB |
| Step | Time |
|---|---|
| From the navigation to the demo graph on the screen, files from the local server | 0.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
- A query on the whole graph with no page reference and no task marker parses each file.
- The search reads the text of each file in the background after the start. A search before the end of that load finds the files that are loaded.
- The graph view shows the 150 pages with the most links. The layout is O(n²) in Tcl.