summaryrefslogtreecommitdiff
path: root/gui/bench/RESULTS.md
blob: 5281ac2fc002579c6b5cc88ee2bf9715063ee76d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# Natural V8 deoptimization and stepping measurements

Measured 2026-11-13 on Linux 7.2.11-arch1-1, Intel i7-11700, Zig 0.17.0,
ReleaseFast debugger; targets are `cc -g -O0` C and unoptimized debug V8.
Source is loaded for both. Capture settings are 512 stack bytes, 24 instructions,
telescope depth 2, mapping refresh and recording flush at every stop. Continue
runs normally between breakpoints; no continuous instruction tracing occurs.

```sh
python3 gui/bench/steps.py --d8 /tmp/computeranim-v8-debug-remote/d8 \
  --source /tmp/computeranim-v8-source --out /tmp/ztrace-natural-bench-final
```

| 1,000 steady instruction steps | C | Debug V8 / TurboFan JS |
| --- | ---: | ---: |
| Capture + flush, median | 48.16 µs | 133.16 µs |
| Capture + flush, p95 | 75.98 µs | 153.33 µs |
| Entire command, median | 55.00 µs | 140.00 µs |
| Controller round trip, median | 68.88 µs | 154.44 µs |
| Controller round trip, p95 | 105.64 µs | 208.51 µs |
| Controller round trip, maximum | 567.93 µs | 539.92 µs |

`capture_ns` covers reporting state plus recording flush. `elapsed_ns` covers the
whole command, including execution/wait and capture. Round trip additionally
includes pipes and the Python driver. Neither includes GUI presentation.
Launch through first generated stop and JIT source import took 1,288.73 ms.
No CPU isolation or filesystem-cache dropping was used. These are workload
measurements, not a release-V8 performance comparison. Per-stop mapping refresh
and natural tiering differ from the earlier forced-optimization demonstration;
its old figures are not directly comparable.

## Verified transition

The ordinary fixture naturally compiled through Maglev and TurboFan. After
warming `jitWork` on `{value:7}`, `{extra:1,value:9}` hit its TurboFan wrong-map
guard. The generated exit's return PC matched the `rdx` origin argument at
`Deoptimizer::New`; unrelated outer-loop bailouts were ignored. Native source
resolved at both Deoptimizer::New (`deoptimizer.cc:290`) and
Runtime_NotifyDeoptimized (`runtime-compiler.cc`). The guard mapped to JS line 3,
`let sum = object.value`. Its shared exit stub mapped to a different JS line, so
origin context deliberately uses the guard.

| Transition stop | Capture + flush | Entire command |
| --- | ---: | ---: |
| generated wrong-map exit | 372.09 µs | 1192.34 µs |
| Deoptimizer::New | 202.01 µs | 214.16 µs |
| Runtime_NotifyDeoptimized | 265.13 µs | 1086.31 µs |
| InterpreterEnterAtBytecode | 445.40 µs | 752.09 µs |
| Ignition property bytecode handler | 15163.99 µs | 15474.67 µs |

The immediate fallback was **Ignition**, confirmed by stopping at
`Builtins_InterpreterEnterAtBytecode` and stepping into
`Builtins_GetNamedPropertyHandler`. This is actual interpreter dispatch,
not an inference from the deoptimizer's frame-reconstruction log. The first
handler capture incurred additional symbol/function work, which is why transition
costs are reported separately from warmed stepping. The script completed with
`mismatch 499509` and `fallback 499507`. Default tiers remain enabled; this does
not imply that other V8 builds always resume Ignition.

Raw logs, recordings and JSON are in `/tmp/ztrace-natural-bench-final`; the
checked-in scripts are the durable reproducer. Addresses/PIDs in those files are
session-specific and `/tmp` artifacts are not permanent.

## Source and build provenance

- Remote: `chaincli-box`, `/home/goblin/v8-research/v8`.
- Revision: `84703f702dca525edd469f3a98d784faa46a02f8`.
- d8: `15.2.0 (candidate)`, existing `out/x64.debug-vuln`.
- `is_debug=true`, `v8_optimized_debug=false`, `symbol_level=2`,
  `v8_symbol_level=2`, `use_debug_fission=true`, `target_cpu="x64"`.
- Disassembler, object printing, heap verification, slow DCHECKs and backtraces
  enabled; `use_remoteexec=false`, `use_siso=false`.
- Existing remote `BUILD.gn` edits and untracked files were preserved. No engine
  patch, rebuild, checkout reset or workstation V8 compilation was needed.

The component runtime (d8, shared libraries, snapshots and ICU data) is at
`/tmp/computeranim-v8-debug-remote`. Matching `src/` and all 2,328 `.dwo` files
were copied from the same checkout to `/tmp/computeranim-v8-source` (about 1.9 GiB
combined). To retrieve again after verifying the same revision:

```sh
rsync -a -e 'ssh -F ~/.ssh/config -o BatchMode=yes' \
  chaincli-box:/home/goblin/v8-research/v8/src/ /tmp/computeranim-v8-source/src/
rsync -a --include='*/' --include='*.dwo' --exclude='*' \
  -e 'ssh -F ~/.ssh/config -o BatchMode=yes' \
  chaincli-box:/home/goblin/v8-research/v8/out/x64.debug-vuln/obj/ \
  /tmp/computeranim-v8-source/out/x64.debug-vuln/obj/
```

This build's skeleton line tables use comp_dir `.` and stripped `../../src`
paths. `source-map ../../src /tmp/computeranim-v8-source/src` resolves them
through the shared debugger source-prefix interface. Native line resolution was
verified; full split-DWARF C++ local-variable inspection was not implemented.

## Verification

`gui/test/inspection.py --d8 /tmp/computeranim-v8-debug-remote/d8` passes bounded
read-only inspection, unchanged RIP, invalid-count rejection, source-prefix
replacement, natural optimization, matching JIT ELF import, native deoptimization
stops and actual fallback dispatch.

GUI tests cover live stepping/pause/history, source stepping, semantic address
navigation, minimap dragging, changed-state animation and lenses. Adaptive tests
use 2240×1260, 1440×900 and 800×700 at 60%, 100% and 200%: full 4 GiB mapping
navigation with single-row precision, per-pane segment history, pinned refresh at
repeated same-PC stops, graph/dim controls and font reset. Independent visual
review additionally checks PC/source alignment, pointer hit targets, compact
minimaps, lens cycles/collapse and native interaction.

The shared renderer/gallery suite passes. The root suite has 87/89 passing tests;
the same two pre-existing loader/syscall-format and watch/string assertions fail
(25/27 debugger tests). No assertions were weakened. The canvas still lacks a
native accessibility tree, and raw hardware Mouse4/5 injection was not tested.

## Final interactive stop

The native GUI remains open with d8 PID 2639255 in Linux tracing-stop state at
`Deoptimizer::New+4`, RIP `0x7fa19dbe3f74`, on native source line 290.
Its `rdx = 0x7fa1e0000ffa` matches the normal `jitWork` TurboFan wrong-map exit's
return PC exactly. The retained JS context is the guard at `0x7fa1e0000c14`,
`jit.js:3`, not the shared exit stub's line 5.

GUI PID 2639214; recording
`/tmp/ztrace-gui-2639214-392301809642450.ztrace`, moment 8.
This session used ordinary default tiering and symbolic native breakpoints.
The complete fallback transition was verified separately by the benchmark above,
so the interactive target can remain at the requested deoptimization entry.

The independent native review passed after exercising graph/source toggling,
all four opacity settings, and Follow. It restored source/live/follow at 100%
without executing the target. Screenshot:
`/tmp/ztrace-ui-review/native-final-reviewed.jpg`. Native font-shortcut injection
was unavailable through the automation tool's punctuation grammar; the actual
headless key handler passed the nine size/zoom combinations.

## Native zoom and restart follow-up

The original headless size tests missed a native resize feedback loop: `canvas()`
also changes the window dimensions. Dividing the window size by font zoom and
passing it back to `canvas()` repeatedly enlarged the window when zoomed out.
The GUI now keeps the canvas at the actual window size and scales drawing,
clipping and pointer coordinates independently. No renderer-library changes were
needed. `test/restart.py --native` verifies the actual SDL window/backing stays
800×700 through 60–200% zoom and repeated zoom key presses, including scaled
button hits and tiny-overlay lens close controls. Headless checks run in the GUI
suite; native checks are explicit because they require a display.

Restart is available through the toolbar arrow, Shift-r, and `restart`. Tests
cover exited, running and stopped targets; each launch creates a fresh recording,
retains the same executable/arguments, and leaves no previous target running.
Breakpoints and JIT symbols reset because process addresses may change.

The reboot cleared the historical `/tmp` artifacts listed above. The same V8
revision's runtime, source and all split DWARF artifacts have been restored into
`.ws/v8-debug/`, an ignored persistent workspace cache. Historical timing results
remain as reported; the fresh UI regression does not remeasure V8 stepping cost.