Skip to main content

max / quasi

2.4 KB · 57 lines History Blame Raw
1 # quasi-bench
2
3 What a described screen costs to render, in time and in allocations.
4
5 ```
6 cargo run --release -p quasi-bench # nanoseconds per render
7 cargo run --release -p quasi-bench --features count # allocations per render
8 ```
9
10 Two builds, because the counting allocator is real instrumentation and a timing
11 number taken through it is a number about the instrumentation.
12
13 Read the allocation count first. It is stable across machines and across
14 whatever else the box is doing; the timing is a sanity check beside it, and on a
15 shared dev box a 10% difference in it is noise.
16
17 Read down the row-count column rather than across renderers. A cost flat across
18 5, 25 and 200 rows is fixed and a cost that tracks them is per-row. Comparing
19 the webview's number to the terminal's compares a string builder to a cell
20 painter, and the two columns do not mean the same thing: the webview emits every
21 row, the terminal draws one 160x50 frame and the rest is scroll state.
22
23 `quasi-immediate` is absent. Its entry point needs a live egui `Ui`, so
24 measuring it means standing up an egui harness rather than calling a function.
25
26 ## Baseline, fw13
27
28 The screen is a copy of MNW's `library_contacts` pane: two tables, five columns
29 and two, linked values in two flavours, a destructive per-row act.
30
31 Allocations per render (allocs / bytes):
32
33 | rows | webview fragment | webview screen | terminal |
34 |------|------------------|----------------|----------|
35 | 5 | 205 / 37,890 | 207 / 38,734 | 2,375 / 357,997 |
36 | 25 | 807 / 146,984 | 809 / 147,828 | 3,988 / 506,255 |
37 | 200 | 6,060 / 1,130,426 | 6,062 / 1,131,270 | 12,576 / 1,230,646 |
38
39 Nanoseconds per render, best of 5 passes of 20,000:
40
41 | rows | webview fragment | webview screen | terminal |
42 |------|------------------|----------------|----------|
43 | 5 | 6,171 | 6,693 | 299,376 |
44 | 25 | 28,026 | 30,225 | 401,624 |
45 | 200 | 204,136 | 206,474 | 497,650 |
46
47 Two things worth knowing before reading these as a verdict on anything.
48
49 The shell is nearly free. A whole screen costs two allocations more than the
50 fragment inside it, at every size, so the head and the stylesheet links are not
51 where a page load goes.
52
53 The terminal is the expensive column and its cost is mostly not per-row. 2,375
54 allocations to draw a five-row screen against the webview's 205, rising only to
55 12,576 at 200 rows where the webview reaches 6,060. Sublinear because the frame
56 clips.
57