Benchmarks¶
What a textual-wasm build costs in CPU, memory and time, measured, with each cost attributed to the layer that causes it: the browser, the Python interpreter, Textual, this project’s driver and data channel, or the application.
Note
The tables on this page are generated from bench/results/latest.json by just bench-report, and the gates fail when the committed copy drifts from the results. Every number here was taken by just bench on the machine described below. Absolute numbers will differ on yours; the ratios between layers, engines and runtimes are the part that carries over.
Summary¶
In these runs, an idle app cost nothing measurable. A static textual-wasm app sitting in a Chromium tab used 0.00% of a core, the same as about:blank, in both the main-thread and the worker build, and wrote nothing to its terminal. In Firefox the empty browser itself idled at about 0.8% and the app read within a few tenths of that, which is about the resolution of the measurement. The common case above the floor is a focused input: Textual blinks its cursor twice a second, and each blink is a redraw - measured at about 1% of a core in Chromium and 2% in Firefox, against 0.2% for the same app on a native terminal.
Most of the measured memory is the interpreter. Of what the benchmark app added to an empty browser tab - 160-175 MiB in Chromium, about 205 MiB in Firefox - Pyodide itself is 106-168 MiB, importing Textual 23-58 MiB, and the app 10-22 MiB. The interpreter’s WebAssembly memory was 43 MiB and did not grow in any of the workloads here.
On this machine, boot took about three seconds on a first visit and two when cached, most of it booting the interpreter (0.8-1.2 s) and installing packages (0.4-1 s, depending on the cache). Starting the benchmark app itself - importing it, composing it and drawing the first frame under Pyodide - took about 0.6 s, in both builds and both engines; a larger app will take longer.
In these runs, most of a message’s cost was not the data channel. A round trip took 0.1 ms in Chromium (Firefox’s clock does not resolve it on this page), a megabyte 3-5 ms, and the page sent far faster than the app could receive - 200,000 messages left in 0.1-0.5 s and took 2.2-3.6 s to handle. But 10,000 messages through the channel took 115 ms in Chromium when Textual’s own message pump, fed the same number from inside Python, took 111 ms. That puts the measured ceiling at Textual’s message queue running under Pyodide: the channel added 4-6% on the main thread, and about 30% in a worker build, where every message also crosses postMessage.
On these workloads, Pyodide ran pure Python about 1.5x slower than CPython, and Textual work 2-7x slower. A loop that touches nothing but the interpreter ran 1.5x (Chromium) to 1.7x (Firefox) slower than natively. Textual’s message pump ran 2.2x to 2.9x slower and mounting widgets 3x to 7x slower, so those workloads lost more than raw interpreter speed explains. The extra is probably in what they do that the loop does not, such as allocation and scheduling, but that was not measured separately; Firefox paid more of it than Chromium.
No leaks observed in textual-wasm under this harness. Over 50,000 messages the WebAssembly memory stayed flat, and so did the browser’s memory in Chromium, where every JavaScript realm can be collected before a reading. The page heap grew by 3-7 KiB per 5,000 messages - about a byte a message, too little for ten rounds to tell from settling - and the nine or so Python objects added per round look like Textual’s bounded render caches filling: run natively for 400,000 messages, the count stayed flat. Firefox offers no way to force a collection, so its memory readings cannot rule a slow leak in or out. Mounting and removing widgets natively did grow, towards a bound of 1,024 entries, because a cache in Textual keeps removed widgets’ render caches alive (Textualize/textual#6665). That is Textual’s, and it happens on a terminal too.
Results¶
The layers the tables are split by (blank, pyodide, textual, tick, app, input) and how each number is read are described in How it is measured below.
The machine¶
measured |
2026-11-12T12:39:53+00:00 at |
CPU |
AMD Ryzen 9 9900X3D 12-Core Processor, 24 threads |
memory |
30 GiB |
OS |
Linux-7.2.11-arch1-1-x86_64-with-glibc2.44 |
browsers |
chromium 156.0.8078.4, firefox 157.0 (Playwright builds, headless) |
runtimes |
Pyodide 314.0.6, Textual 8.2.8, CPython 3.14.8, Node v26.12.1 |
Idle CPU¶
Percent of one core used by the whole browser (every process it runs) while the page sits untouched, median of the runs. + is what the layer adds to the one it builds on: each rung adds to the one above, except that tick and app both build on textual (the app no longer runs the tick while idle) and input builds on app. Readings are in steps of 0.1 (10ms of CPU over a 10s window).
layer |
chromium main |
+ |
chromium worker |
+ |
firefox main |
+ |
firefox worker |
+ |
|---|---|---|---|---|---|---|---|---|
blank |
0.00 |
0.00 |
0.80 |
0.80 |
||||
pyodide |
0.00 |
+0.00 |
0.00 |
+0.00 |
0.80 |
+0.00 |
0.80 |
+0.00 |
textual |
0.00 |
+0.00 |
0.00 |
+0.00 |
0.50 |
-0.30 |
1.00 |
+0.20 |
tick |
0.50 |
+0.50 |
0.50 |
+0.50 |
1.69 |
+1.20 |
1.89 |
+0.90 |
app |
0.00 |
+0.00 |
0.00 |
+0.00 |
1.00 |
+0.50 |
1.20 |
+0.20 |
input |
1.00 |
+1.00 |
0.80 |
+0.80 |
2.09 |
+1.10 |
2.39 |
+1.20 |
The same two apps on a real terminal, through Textual’s own driver:
native |
|
|---|---|
static app |
0.00 |
blinking input |
0.20 |
What an idle page redraws¶
Terminal writes per second and characters per second while idle - a count, so it is exact rather than a reading. native counts the bytes the app wrote to its pty.
chromium main |
chromium worker |
firefox main |
firefox worker |
native |
|
|---|---|---|---|---|---|
static app: writes/s |
0.0 |
0.0 |
0.0 |
0.0 |
- |
static app: characters/s |
0.0 |
0.0 |
0.0 |
0.0 |
0.0 |
blinking input: writes/s |
2.0 |
2.0 |
2.0 |
2.0 |
- |
blinking input: characters/s |
1,365 |
1,365 |
1,365 |
1,365 |
2,020 |
Where the main thread’s idle time goes (Chromium)¶
Milliseconds per second of the page’s main thread, from Chromium’s own accounting. In a worker build the interpreter is not on this thread, so its time is not here.
chromium main |
chromium worker |
|
|---|---|---|
tick: all tasks |
4.65 |
0.01 |
tick: script |
0.52 |
0.00 |
app: all tasks |
0.06 |
0.05 |
app: script |
0.00 |
0.00 |
input: all tasks |
6.01 |
2.19 |
input: script |
0.62 |
0.53 |
Idle CPU, before and after the input-only parser timer¶
Until the driver ticked its escape-sequence parser only after input, it ticked it every 50ms for the app’s whole life. The earlier run (e5c0c19, 2026-11-12) against this one, percent of one core:
chromium main |
chromium worker |
firefox main |
firefox worker |
|
|---|---|---|---|---|
static app, before |
0.50 |
0.60 |
1.99 |
2.09 |
static app, after |
0.00 |
0.00 |
1.00 |
1.20 |
blinking input, before |
1.40 |
1.30 |
2.89 |
3.39 |
blinking input, after |
1.00 |
0.80 |
2.09 |
2.39 |
Boot time¶
Milliseconds, median of the runs, split at the page’s own boot marks. A first visit downloads the interpreter and the wheels from the CDN, so its numbers depend on the network as much as on the machine; the cached rows are a reload.
chromium main |
chromium worker |
firefox main |
firefox worker |
|
|---|---|---|---|---|
page and terminal loaded (first visit) |
256 |
285 |
375 |
367 |
interpreter boot (first visit) |
1,219 |
1,122 |
1,153 |
1,122 |
packages installed (first visit) |
782 |
850 |
861 |
966 |
app started and drawn (first visit) |
593 |
600 |
629 |
630 |
total, navigation to running (first visit) |
2,867 |
2,862 |
2,989 |
3,059 |
page and terminal loaded (cached) |
23 |
30 |
50 |
56 |
interpreter boot (cached) |
837 |
889 |
817 |
839 |
packages installed (cached) |
383 |
386 |
437 |
435 |
app started and drawn (cached) |
595 |
598 |
625 |
623 |
total, navigation to running (cached) |
1,832 |
1,902 |
1,932 |
1,950 |
Memory¶
Proportional set size of the whole browser in MiB once each layer is up and settled - shared pages divided between the processes sharing them, so the column sums to what the browser holds. + is what each layer adds to the one it builds on, as above.
layer |
chromium main |
+ |
chromium worker |
+ |
firefox main |
+ |
firefox worker |
+ |
|---|---|---|---|---|---|---|---|---|
blank |
169 |
169 |
422 |
422 |
||||
pyodide |
275 |
+106 |
305 |
+136 |
551 |
+130 |
590 |
+168 |
textual |
317 |
+42 |
334 |
+29 |
609 |
+58 |
613 |
+23 |
tick |
314 |
-3 |
334 |
+0 |
619 |
+10 |
625 |
+12 |
app |
330 |
+13 |
344 |
+10 |
631 |
+22 |
626 |
+13 |
input |
330 |
+0 |
345 |
+0 |
635 |
+4 |
639 |
+13 |
The page’s JavaScript heap after a forced collection (Chromium; a worker’s heap is not the page’s and is not included), in MiB:
layer |
chromium main |
+ |
chromium worker |
+ |
|---|---|---|---|---|
blank |
0.5 |
0.5 |
||
pyodide |
8.3 |
+7.8 |
1.1 |
+0.5 |
textual |
9.0 |
+0.7 |
1.1 |
+0.0 |
tick |
9.1 |
+0.0 |
1.1 |
+0.0 |
app |
10.3 |
+1.3 |
2.4 |
+1.3 |
input |
10.4 |
+0.0 |
2.5 |
+0.0 |
From inside the interpreter, with the app running:
chromium main |
chromium worker |
firefox main |
firefox worker |
|
|---|---|---|---|---|
WebAssembly memory (MiB) |
43 |
43 |
43 |
43 |
Python objects tracked by gc |
60,054 |
60,051 |
60,053 |
60,053 |
The data channel¶
Timed inside the page, median of the repeats. The burst row is the longest gap between two animation frames while the page sends a burst and the app handles it; the row under it is the same measurement with no burst, which is what one frame is on this machine. Firefox rounds performance.now() to whole milliseconds on a page that is not cross-origin isolated, so its sub-millisecond rows read 0 or 1.
chromium main |
chromium worker |
firefox main |
firefox worker |
|
|---|---|---|---|---|
round trip, median (ms) |
0.10 |
0.10 |
0.00 |
0.00 |
round trip, p95 (ms) |
0.20 |
0.20 |
1.00 |
1.00 |
10,000 messages, sent and handled (ms) |
115 |
138 |
149 |
184 |
messages handled per second |
86,655 |
72,727 |
67,114 |
54,348 |
200,000 messages: sending (ms) |
383 |
124 |
452 |
235 |
200,000 messages: until all handled (ms) |
2,227 |
2,646 |
2,875 |
3,616 |
200,000 messages: received |
200,000 |
200,000 |
200,000 |
200,000 |
1 MiB round trip (ms) |
3.60 |
4.70 |
3.00 |
4.00 |
8 MiB round trip (ms) |
23.80 |
28.20 |
20.00 |
19.00 |
|
20,000 |
20,000 |
20,000 |
20,000 |
messages the app received from them |
1 |
1 |
1 |
1 |
longest frame gap during a burst (ms) |
33.30 |
16.80 |
66.26 |
17.08 |
longest frame gap, no burst (ms) |
16.80 |
16.80 |
17.08 |
17.08 |
Whose cost: interpreter, Textual, or channel¶
The same workloads, timed from inside Python, in every runtime. The loop touches nothing but the interpreter, so the ratio between its native and browser columns is what the interpreter costs; a workload whose ratio matches it is slow because of the interpreter rather than anything on top. Milliseconds, median.
chromium main |
chromium worker |
firefox main |
firefox worker |
native |
|
|---|---|---|---|---|---|
pure-Python loop, 3,000,000 iterations |
142 |
143 |
164 |
159 |
97.47 |
Textual message pump, 10,000 self-posted messages |
111 |
106 |
141 |
143 |
48.98 |
mount and remove 200 widgets |
50.90 |
53.40 |
114 |
116 |
16.62 |
The channel’s throughput, against the bridge and Textual’s message queue with the page, the transport and the browser removed (native, the bridge’s callback called directly):
chromium main |
chromium worker |
firefox main |
firefox worker |
|
|---|---|---|---|---|
10,000 messages through the channel |
115 |
138 |
149 |
184 |
native |
|
|---|---|
10,000 messages, bridge called directly |
50.81 |
Leaks¶
A workload repeated in rounds, with memory read after each from every vantage point and a full collection first. Growth that continues into the second half is a leak, and the row it shows in says whose: Python objects are Python, the JS heap is the page, PSS is everything including the interpreter’s linear memory.
Messages: 10 rounds of 5,000 messages through the channel.
chromium main |
chromium worker |
firefox main |
firefox worker |
|
|---|---|---|---|---|
Python objects: before |
60,055 |
60,048 |
60,053 |
60,053 |
Python objects: after |
60,144 |
60,137 |
60,142 |
60,142 |
Python objects per round, second half |
8.69 |
8.46 |
9.14 |
9.14 |
page JS heap KiB per round, second half |
6.50 |
3.33 |
- |
- |
WebAssembly MiB: before |
43.25 |
43.25 |
43.25 |
43.25 |
WebAssembly MiB: after |
43.25 |
43.25 |
43.25 |
43.25 |
browser PSS MiB per round, second half |
0.02 |
-0.02 |
-1.31 |
0.65 |
Widgets: 10 rounds of mounting and removing 200 widgets.
chromium main |
chromium worker |
firefox main |
firefox worker |
|
|---|---|---|---|---|
Python objects: before |
60,053 |
60,053 |
60,051 |
60,056 |
Python objects: after |
74,629 |
74,629 |
73,845 |
73,850 |
Python objects per round, second half |
9.86 |
-31.29 |
-192 |
-102 |
page JS heap KiB per round, second half |
5.94 |
2.12 |
- |
- |
WebAssembly MiB: before |
43.25 |
43.25 |
43.25 |
43.25 |
WebAssembly MiB: after |
43.25 |
43.25 |
43.25 |
43.25 |
browser PSS MiB per round, second half |
0.08 |
0.13 |
1.41 |
4.07 |
Both workloads natively, under App.run_test, for more rounds - each costs milliseconds there - so that caches filling can be told apart from a leak:
native |
|
|---|---|
messages: rounds |
80 |
messages: Python objects before |
132,649 |
messages: Python objects after |
131,538 |
messages: Python objects per round, second half |
1.00 |
widgets: rounds |
80 |
widgets: Python objects before |
83,969 |
widgets: Python objects after |
132,648 |
widgets: Python objects per round, second half |
254 |
How it is measured¶
Attribution: one layer at a time¶
A number measured against the full page says what the page costs, and nothing about why. So every idle and memory measurement is taken on a ladder of pages, each one layer above the last, all served from the same build and brought up by the build’s own boot.mjs:
Layer |
What is running |
|---|---|
|
|
|
The interpreter booted, running nothing. |
|
The build’s requirements installed and Textual imported, still running nothing. |
|
The above plus one asyncio task waking every 50ms: the escape-sequence timer the driver kept running before it was made input-only, and nothing else of the driver. |
|
The benchmark app: a static screen, running, untouched. |
|
An app with a focused, blinking input: the common case above the floor. |
The difference between two adjacent rows is what the added layer costs. Each layer runs in both builds - the interpreter on the page’s main thread, and in a Web Worker - and in Chromium and Firefox.
A second ladder runs sideways, from the browser to a native terminal. The same apps run on CPython in a real pseudo-terminal through Textual’s own platform driver (textual_wasm.reference, the same reference the render check uses), and the same workloads run natively under App.run_test. A browser number next to its native counterpart says what the browser runtime adds.
What is read, and how¶
CPU is the user and system time of the whole browser process tree - the browser, its renderer, GPU and utility processes, and any worker - read from the operating system over a 10-second window while the page is untouched. It is reported as a percentage of one core. The page’s own APIs see one thread; the process tree sees everything the browser did.
Main-thread breakdown comes from Chromium’s own accounting through the DevTools protocol: how much of the main thread’s time went to tasks and to script. It sees the page’s main thread only, so in a worker build the interpreter’s time is in the CPU column and not here.
Redraws are counted rather than timed: the page counts every write the app makes to the terminal (
textualWasm.output()). An idle app that redraws for no reason shows up as a number that is not zero.Memory is the proportional set size (PSS) of the browser’s process tree: every shared page divided between the processes that share it, so the total is what the browser really holds rather than six copies of the same libraries. Beside it are the page’s JavaScript heap after a forced collection (Chromium), the interpreter’s WebAssembly memory, and the number of Python objects the cycle collector tracks.
Boot time is split at
performance.marks the page leaves as each step starts, all on the page’s own clock in both builds.The data channel is timed inside the page, never from the automation driver, whose own round trip would swamp a 0.1ms crossing.
Leaks are found by repeating a workload in rounds and reading memory after each, after a full collection of Python, the page and - in Chromium - the worker. Growth that continues into the second half of the rounds is a leak; the counter it shows in says whose.
Each case runs in a fresh browser, one at a time, so no measurement carries another’s leftovers and no two browsers compete for the machine. Durations are medians over repeats.
Whose cost: the controls¶
Three workloads run inside Python, timed from inside Python, identically in every runtime:
a pure arithmetic loop, which touches nothing but the interpreter;
a flood of messages an app posts to itself, which is Textual’s message pump with no channel involved;
mounting and removing widgets, which is Textual’s DOM and compositor.
The loop’s native-to-browser ratio is the cost of running CPython as WebAssembly. A workload with the same ratio is slow because of the interpreter, not because of anything built on it. The data channel’s throughput is compared the same way, against the bridge fed directly under CPython, with the page, the transport and the browser removed.
Reproducing¶
just install && just install-browsers chromium firefox
just bench # about an hour; resumes where it stopped if interrupted
just bench-report # regenerate the tables on this page
just bench-smoke runs every case at toy sizes in a few minutes, to check the harness works. Chromium and Firefox are the default engines; just bench --engine webkit adds Playwright’s WebKit where it is installed, and --only NAME reruns the cases whose name contains NAME. The harness itself is in bench/: the apps it measures, the scenario runner and the baseline pages. A first visit fetches Pyodide and the wheels from jsDelivr, so the first-visit boot rows depend on the network; everything else is local.
The benchmark also runs weekly on a GitHub runner (bench.yml), with the tables in the job summary. Those numbers are noisier than a quiet machine’s and are not the ones on this page. What runs on every push is the part that cannot be noisy: tests/test_bench.py asserts the counted results - an idle app writes nothing, no message is dropped, the page is published only once the app has drawn - in a real browser, in both builds.