Repository navigation
Commit a80c623
Pine adapter: recover the per-bar cost of the margin, sizing and admission rules (#336)
* Pine adapter: the retired-row sweep reads the placement rows in place
On a gathered chart (a script timeframe above the input timeframe),
pin K5 keeps every entry row of the run, so the sweep at each bar open
(erase_retired_rows) walked a table that grows with the run,
re-finding each row and binary-searching the askable origins before
reading the row's own pin: the per-bar cost rose with every entry
placed. The sweep now reads the rows straight off the table's storage,
in the same incarnation order (PlacementTable::visit_rows), and tests
a row's own pin before the searches. It keeps and erases exactly the
rows it did.
Alongside, each value-identical: decimal_grid_exponent forms its
nineteen powers once, by the same expressions; gain_loss_regime and
slipped_long_margin_scope read the configuration before the run;
on_bar_open takes the point-order scan only under the point order; the
narrow-scope margin and admission helpers stay out of line (two) or
out of line and cold (six), and thirteen of their scope tests are
hinted rare.
The recovery is for gathered charts. With the script timeframe equal to
the input timeframe the table stays small, the sweep is cheap anyway,
and the cost the margin, sizing and admission rules added since
14b05c9 remains (native example batch median +5.7 %); the next
commit takes it.
No decision, order of operations, hashed field or floating-point value
moves: against the admission change (#335) the witness harvests (every
pinned state hash), a per-trade dump of all 21 Trade fields (%.17g,
every run pass), the no-hash digests and the tape suites are
byte-identical, and release ctest passes with the receipt rows. Doc
citation digits re-anchored.
Timing, measured on the admission change (#335) before its final rebase
(same library):
Xeon 8375C, CPU 2, 61 rotating blocks x 3 independent builds per tree
x 5 runs, paired block bootstrap; every 95% interval within 0.21
points, * = it covers 0.
percent vs native ta-sma bracket udt vcp
batch median, gathered (1 m input, 3 m script)
14b05c9 +0.05* -0.05* -1.95 -0.38 -0.29
#335 (parent) -4.31 -2.56 -2.98 -3.63 -2.07
batch median, ungathered (1 m input, 1 m script)
14b05c9 +5.70 -0.33 +0.07* +4.19 +2.09
#335 (parent) -1.06 -3.01 -1.24 -1.00 -2.25
stream p95, gathered
14b05c9 +0.89 -0.18 -0.90 +2.77 +3.41
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
* Pine adapter: margin and admission scopes answer from the configuration; no sort or copy for a lone command
The margin and admission scopes are asked several times a bar, and on a
run outside them -- no power-of-ten lot step, a commission, pyramiding
above one -- the configuration alone answers. Those conjuncts are now
formed when the configuration is set (set_configuration and
set_staged_configuration, the only writers of config_ and staged_), so
such a bar answers each scope with one read instead of a call; inside a
scope its own tests run as before, and the rule switches are still read
at every ask. The unified admission at resolve_terms moves out of line
unchanged, and the realized-money fold returns at once when nothing was
booked since the last one.
Alongside, on the same per-bar path: the same-bar command flush no longer
stable-sorts a one-command queue (std::stable_sort still took a
temporary buffer and moved the command, its whole placement snapshot
included, through it and back) and keeps the queue's storage for the
next bar; cancel_bracket_siblings and apply_fx_opening_margin_slice
decide before copying the filled row; close_all records the close-first
fact from the point and position it has already read; on_bar_open forms
the opening print only under the point order; the retired-row sweep's
visitors are inlined.
No decision, order of operations, hashed field or floating-point
value moves. Against the previous commit: the whole-suite dump
(every closed and range-end trade with all 21 Trade fields at %.17g,
every recorded per-bar, broker and stream state hash) is
byte-identical on 659 of 663 process files (4 of them matched by
content: their name hashes a temp-path argument), and the other 4
differ by run, not by tree (a timing-calibrated row, a stack-address
row, two concurrent writers identical when run alone, twice in each
tree); the 30 witness harvests (no re-pin) and 176 tape and witness
executables are byte-identical; release ci_verify 859/859 with the
receipt rows; corpus 312/312, moved 0. The seven new members are
functions of the folded configuration and are waived as such. Doc
citation digits re-anchored.
Timing (Xeon 8375C, CPU 2; 4 independent builds per tree resampled as a
random effect, blocks paired; percent against 14b05c9, 95% CI; largest
build-to-build A/A 0.11 % / 0.27 % on the whole-batch median):
whole-batch median stream mean per call stream p95
script timeframe = input timeframe (81 blocks)
native example -1.5 [-1.5,-1.4] -2.8 [-2.8,-2.7] -2.1 [-2.2,-2.1]
ta-sma-dual-cross -1.9 [-2.0,-1.9] -0.5 [-0.5,-0.4] +0.4 [+0.4,+0.5]
bracket-aurora +0.2 [+0.1,+0.2] -0.7 [-0.8,-0.7] +1.0 [+1.0,+1.1]
udt-regime-stack +0.4 [+0.4,+0.5] -0.8 [-0.9,-0.8] +0.4 [+0.3,+0.5]
composite-vcp +2.6 [+2.5,+2.6] +1.6 [+1.5,+1.6] +2.2 [+2.1,+2.3]
1-minute input under a 3-minute script (41 blocks)
native example -5.2 [-5.3,-5.0] -4.4 [-4.5,-4.3] -5.0 [-5.1,-4.9]
ta-sma-dual-cross -2.2 [-2.3,-2.1] -1.2 [-1.3,-1.1] +0.2 [+0.1,+0.5]
bracket-aurora -3.6 [-3.7,-3.5] -3.3 [-3.4,-3.2] -5.8 [-5.9,-5.7]
udt-regime-stack -2.6 [-2.8,-2.5] -2.3 [-2.4,-2.2] -0.4 [-0.7,-0.1]
composite-vcp † -0.4 [-0.5,-0.2] +0.4 [+0.3,+0.4] +2.0 [+2.0,+2.2]
† Not a property of this commit: this row moves with the size of the
process environment. setenv("TZ") (src/timezone.cpp) costs one heap
trim and re-grow per run, about 85 us over 5,003 bars, and the row
reads -0.3 to -0.6 with some environment sizes and +1.5 (+1.9 against
the previous commit) with others. Whole-batch differences under
0.5 % read as at par.
In the same runs the previous commit stood at +5.6, -0.3, +0.1, +4.2,
+2.0 (script timeframe = input timeframe) and -0.2, -0.1, -2.0, -0.4,
-0.1 (3-minute script) on the whole-batch median, and the admission
change (#335) at +6.7, +2.9, +1.4, +5.2, +4.4 and +4.5, +2.6, +1.1,
+3.4, +2.0. composite-vcp's remaining gap is the session clock in
src/session_time.cpp (time() with a session argument every bar), which
this commit does not touch.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
* Tests: run the lookup-index and live-state scaling rows serially in Release
Under a parallel ctest the lookup-index scaling row once read 6.15
against its 5.0 bound, and 4.08 when run alone; the live-state scaling
row failed the same way under load. RUN_SERIAL keeps other rows off the
box while these two time their legs, in Release, where their ratios
gate. A whole Release suite at -j 28 read 3.99-4.01 with it and
3.82-4.83 without, for about a minute more wall time. No source or
behaviour change.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>1 parent 6b77f06 commit a80c623
7 files changed
Lines changed: 524 additions & 291 deletions
File tree
- docs
- adr
- design
- include/pineforge/source
- scripts
- src/source
- tests
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | | - | |
| 176 | + | |
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
186 | | - | |
| 186 | + | |
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
202 | | - | |
| 202 | + | |
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
213 | | - | |
| 213 | + | |
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
244 | | - | |
| 244 | + | |
245 | 245 | | |
246 | 246 | | |
247 | 247 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
576 | 576 | | |
577 | 577 | | |
578 | 578 | | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
579 | 597 | | |
580 | 598 | | |
581 | 599 | | |
| |||
1884 | 1902 | | |
1885 | 1903 | | |
1886 | 1904 | | |
| 1905 | + | |
1887 | 1906 | | |
| 1907 | + | |
1888 | 1908 | | |
1889 | 1909 | | |
1890 | 1910 | | |
1891 | 1911 | | |
1892 | 1912 | | |
1893 | 1913 | | |
| 1914 | + | |
| 1915 | + | |
| 1916 | + | |
1894 | 1917 | | |
1895 | 1918 | | |
1896 | 1919 | | |
1897 | 1920 | | |
1898 | 1921 | | |
| 1922 | + | |
1899 | 1923 | | |
1900 | 1924 | | |
1901 | 1925 | | |
1902 | 1926 | | |
1903 | 1927 | | |
| 1928 | + | |
1904 | 1929 | | |
1905 | 1930 | | |
1906 | 1931 | | |
| |||
2513 | 2538 | | |
2514 | 2539 | | |
2515 | 2540 | | |
| 2541 | + | |
| 2542 | + | |
| 2543 | + | |
| 2544 | + | |
| 2545 | + | |
| 2546 | + | |
| 2547 | + | |
| 2548 | + | |
| 2549 | + | |
| 2550 | + | |
| 2551 | + | |
| 2552 | + | |
| 2553 | + | |
| 2554 | + | |
| 2555 | + | |
| 2556 | + | |
| 2557 | + | |
| 2558 | + | |
| 2559 | + | |
| 2560 | + | |
| 2561 | + | |
| 2562 | + | |
2516 | 2563 | | |
2517 | 2564 | | |
2518 | 2565 | | |
| |||
0 commit comments