perf(v4): POST at a boot's pace -- v3's per-suite put-back, and a lookup that rejects by two bytes (#189)

Ruled (Captain Bob, 2026-11-14): "Find the TCG cost first". v3's whole POST took the amd64
accept from about 3 m 15 s to 8 m 45 s, and aarch64 past its 570 s (logs/20261114-091651,
STOPPED, committed). Profiled on the host (gprof, mesh-boot): 87% of the time in POST's
lines, about 280,000 opcodes a line -- the interpreter's dictionary lookup.

- POST puts the dictionary back before each of v3's suites, as v3's run_test_suite does
  ("to remove test-created words"): a mark, (POST), forgotten and made again
  (V4_POST_SUITE). Only the dictionary: SCR, BASE and the rest stay as the cases left them.
- (LOOKUP) tries each entry by its count and first character first -- one fetch of the
  name's first cell, masked -- and only then its hidden flag and the whole name. The answer
  is the same; an entry that cannot be it costs a few opcodes, not some forty.

mesh-boot: 37.7 s -> 15.7 s, POST 990 of 990. make -C v4 test: all v4 tests passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
Claude
2026-11-14 13:26:45 +00:00
parent 37469f6c54
commit 281972abb2
11 changed files with 318 additions and 273 deletions
+4
View File
@@ -163,3 +163,7 @@ with no kernel has none of them (`V4_POST_KERNEL`, `v4_post_host.kernel`). The t
`DATA_STRUCTURES.stack_min_max` (VARIABLE run inside a definition took '42' for its name, and hid the number
from every case after it) and `COMPLETE_PROGRAMS.array_sum` (`: ARRAY 5 CELLS ALLOT ;` names nothing).
- **mkpost cuts no line between a word and the name it takes** (`: T20` cut after the `:` was "Name missing").
- **The boot's time (2026-11-14):** at 990 cases the amd64 accept took 8 m 45 s (about 3 m 15 s at 539), and
aarch64 ran out of its 570 s in POST (`logs/20261114-091651/aarch64`, STOPPED). The node's doubling is not the
cost (host mesh-boot 36 s at 16384 words, 37.7 s at 32768). **Ruled (Captain Bob): "Find the TCG cost
first"** -- profile POST under emulation and bring 990 cases under 570 s on all three, before the push.
+2 -2
View File
@@ -141,9 +141,9 @@ standard's and not v3's.
| `DECAY-RATE@.basic` | `DECAY-RATE@ . CR` | stack `empty`, printed `0 \n` | unchanged | stack `empty`, prints `1 \n` | v3's own word: the build's DECAY_RATE_PER_US_Q16, 1 by default (v3/Makefile, Kconfig.physics); the v3 that made the table was built with 0 |
| `Q.VARIANCE.three_cells` | `100 HERE ! 200 HERE 8 + ! 300 HERE 16 + ! HERE 3 Q.VARIANCE Q.TO-INT . CR` | stack `empty`, printed `6666 \n` | `100 HERE ! 200 HERE 1 + ! 300 HERE 2 + ! HERE 3 Q.VARIANCE Q.TO-INT . CR` | stack `empty`, prints `6666 \n` | v3's address unit is a byte in 8-byte cells; v4's is a cell (D-1): the case in v4's units, a byte address 4 * a cell's |
| `INFER-DECAY-SLOPE.three_cells` | `300 HERE ! 200 HERE 8 + ! 100 HERE 16 + ! HERE 3 INFER-DECAY-SLOPE Q.TO-INT . CR` | stack `empty`, printed `0 \n` | `300 HERE ! 200 HERE 1 + ! 100 HERE 2 + ! HERE 3 INFER-DECAY-SLOPE Q.TO-INT . CR` | stack `empty`, prints `0 \n` | v3's address unit is a byte in 8-byte cells; v4's is a cell (D-1): the case in v4's units, a byte address 4 * a cell's |
| `INFER-VARIANCE@.after_run` | `INFER-RUN INFER-VARIANCE@ Q.TO-INT . CR` | stack `empty`, printed `0 \n` | `INFER-RUN INFER-VARIANCE@ Q.TO-INT DROP CR` | stack `empty`, prints `\n` | the value comes of the run's own history, the same on no two runs or machines: the case as its description has it ('no error') |
| `INFER-VARIANCE@.after_run` | `INFER-RUN INFER-VARIANCE@ Q.TO-INT . CR` | stack `empty`, printed `39 \n` | `INFER-RUN INFER-VARIANCE@ Q.TO-INT DROP CR` | stack `empty`, prints `\n` | the value comes of the run's own history, the same on no two runs or machines: the case as its description has it ('no error') |
| `INFER-WINDOW@.after_run` | `INFER-RUN INFER-WINDOW@ . CR` | stack `empty`, printed `0 \n` | `INFER-RUN INFER-WINDOW@ DROP CR` | stack `empty`, prints `\n` | the value comes of the run's own history, the same on no two runs or machines: the case as its description has it ('no error') |
| `INFER-EARLY-EXIT@.after_run` | `INFER-RUN INFER-EARLY-EXIT@ . CR` | stack `empty`, printed `1 \n` | `INFER-RUN INFER-EARLY-EXIT@ DUP 0= SWAP 1 = OR . CR` | stack `empty`, prints `-1 \n` | the value comes of the run's own history, the same on no two runs or machines: the case as its description has it ('no error') (0 or 1) |
| `INFER-EARLY-EXIT@.after_run` | `INFER-RUN INFER-EARLY-EXIT@ . CR` | stack `empty`, printed `0 \n` | `INFER-RUN INFER-EARLY-EXIT@ DUP 0= SWAP 1 = OR . CR` | stack `empty`, prints `-1 \n` | the value comes of the run's own history, the same on no two runs or machines: the case as its description has it ('no error') (0 or 1) |
| `Q.1.raw_value` | `Q.1 . CR` | stack `empty`, printed `65536 \n` | `Q.1 D. CR` | stack `empty`, prints `65536 \n` | Q48.16 on v4 is a double, low cell then high (ruled 2026-11-14): its raw value printed with D. |
| `Q.0.raw_value` | `Q.0 . CR` | stack `empty`, printed `0 \n` | `Q.0 D. CR` | stack `empty`, prints `0 \n` | Q48.16 on v4 is a double, low cell then high (ruled 2026-11-14): its raw value printed with D. |
| `Q.SCALE.raw_value` | `Q.SCALE . CR` | stack `empty`, printed `65536 \n` | `Q.SCALE D. CR` | stack `empty`, prints `65536 \n` | Q48.16 on v4 is a double, low cell then high (ruled 2026-11-14): its raw value printed with D. |