Skip to content

Native stream: fewer temporary strings and lookups on the confirmed-bar path - #338

Merged
luisleo526 merged 3 commits into
mainfrom
lv/perf325
Oct 5, 2026
Merged

luisleo526 merged 3 commits into
mainfrom
lv/perf325

Conversation

@luisleo526

@luisleo526 luisleo526 commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

These are two performance-only changes on the confirmed-bar stream path, plus a documentation anchor refresh.

  • Continuation hashing (src/native_execution_consumer.cpp) folds its fields without building temporary strings.
  • Retiring source rows (src/source/pine_adapter.cpp) reuses the lookups it already made instead of repeating them per row.

No behaviour changes.

Behaviour: bit-identical

  • Stream-state hashes: 25,005 of 25,005 are identical to main, over five strategies, compared at every pushed bar. The comparison was repeated across four independent build pairs, and the action traces are identical too.
  • Hash-fold differential: 500,003 operations per compiler profile, under GCC -O0/-O2/-O3 and Clang -O2 (2,000,012 in total), with 0 mismatches.
    • Inputs cover raw signed and floating-point bit patterns, booleans, tags and boundary values.
  • Existing tests: the confirmed-bar input-domain pins and the live-state equivalence suite pass. The latter gains a case for the retirement path.
  • Corpus parity: 312 / 312 with 0 moved, plus the full parity sweep (see the pineforge/parity status).

Kernel note: the change to src/native_execution_consumer.cpp is performance-only. Its output is bit-identical (the hash input bytes do not change), and it is not motivated by Pine parity. Kernel-gate boundary findings: 0.

Performance

Measured on a dedicated, otherwise idle cloud machine:

  • one pinned CPU with its hyper-thread sibling kept idle;
  • four independent builds per side, without a compiler cache;
  • builds interleaved in rotating order;
  • 95% confidence intervals from a two-stage bootstrap (builds, then runs), so build-to-build variation is in the error bars.

Against the current main (the library this PR merges onto):

Native example strategy Change 95% CI
Stream push, median per bar −8.06% [−8.14, −7.97]
Stream push, p95 per bar −2.77% [−2.84, −2.68]
Stream push, p95 on script-close bars without fills −3.32% [−3.45, −3.17]
Batch backtest, median per input −0.50% [−0.67, −0.34]

On that machine, the build-to-build spread of the stream p95 is at most 0.16%, and a same-binary control is within 0.13%. An earlier measurement against an older main gave the same picture: stream median −8.84%, stream p95 −1.73%, batch median −0.86%.

🤖 Generated with Claude Code

@luisleo526
luisleo526 merged commit 44eab7b into main Oct 5, 2026
17 checks passed
@luisleo526
luisleo526 deleted the lv/perf325 branch October 5, 2026 02:16
luisleo526 added a commit that referenced this pull request Oct 5, 2026
* docs: release notes and version scoping for v1.2.0

CHANGELOG: the Unreleased section becomes 1.2.0 (2026-10-05), a minor
release that adds the compiled execution-capabilities extension to the C
ABI (PF_CAPABILITIES_API_VERSION, strategy_capabilities_api_version,
strategy_capabilities_receipt). One bullet per change since v1.1.0 with
its PR (#328, #330, #331, #332, #333, #334, #335, #336, #337, #338 and the
session-clock change, written #VCP until its PR number exists), the
recipe additions under State hashes (#328, #330, #335; domain tags and
epoch unchanged), Report keys (docker/run_json.py is byte-identical to
v1.1.0's, so no key changes) and Migration.

Version scoping: README, install and public-contract pages name v1.2.0
and codegen 1.2.0; "since the next release" and "fixed on main" in the
capabilities guide and the runner guide become 1.2.0 and 1.1.0 (#325).
Lines that state what an earlier release shipped stay.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* docs: 1.2.0's grades from the facts tokens, #339, and codegen's license

- CHANGELOG: the session-clock change is #339 (merged as 52292db), in place
  of the #VCP token of 3082fbd; the "What a script author sees" bullet of
  3082fbd now states release 1.2.0's grades (registry baseline
  pineforge-parity-baseline-20261005-engine-52292db9: 7,970 excellent / 19
  strong of 7,989, none below strong) instead of the main scoreboard at
  6b77f06.
- README: the release sentence names 1.2.0 and renders releases[1.2.0], and
  the main scoreboard renders the same baseline, from pineforge-release
  facts/facts.json at 0c2f6838 (the facts export for the 1.2.0 release).
- README, LEGAL.md, docs/pages/index.md: pineforge-codegen is under the
  PineForge Source License 1.1 from its release 1.2.0; releases up to 1.1.0
  keep the PolyForm Noncommercial terms they shipped with.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant