PineForge
unreleased
Deterministic PineScript v6 backtest runtime — C ABI reference
Loading...
Searching...
No Matches
scratch_defaults.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <
pineforge/detail/scratch_errors.hpp
>
4
#include <
pineforge/detail/scratch_tables.hpp
>
5
6
#include <cstddef>
7
#include <cstdint>
8
#include <limits>
9
10
namespace
pineforge::detail
{
11
12
// Physical resident rows <= 2x the rows kept at the last spill pass + 64
13
// (+ pinned rows); this is not a bound in terms of currently live rows.
14
// Admission still limits non-spillable cohort rows in the bounded scratch
15
// profile. This does not bound the number or heap size of pending orders.
16
inline
constexpr
std::size_t
kMaxResidentCohorts
= 4096;
17
18
// P0 is a POLICY admission tier, not a measured bound or a proof that a
19
// strategy fits. Counts include historical keys and internally generated
20
// successors. The finite-batch replacement reserve deliberately scales with
21
// input bars; actual exhaustion must fail, never grow or fall back to disk.
22
inline
ScratchManifest
default_scratch_manifest
(std::uint64_t bars) {
23
if
(bars > std::numeric_limits<std::uint64_t>::max() / 2)
24
throw
ScratchCapacityError
(
ScratchResource::layout
,
25
"default scratch replacement reserve overflow"
);
26
return
{
27
0, 0,
// K_q/B_q retained in the descriptor; the q store is removed.
28
262144, 25165824,
29
32768, 4227072,
30
65536, 4194304,
31
27, 6912,
32
2 * bars,
33
};
34
}
35
36
// A stream without a declared lifetime bar count has its own fixed policy
37
// tier. A zero-bar finite batch remains distinct and admits zero roots.
38
inline
ScratchManifest
default_scratch_manifest
() {
39
auto
manifest =
default_scratch_manifest
(0);
40
manifest.R = 65536;
41
return
manifest;
42
}
43
44
}
// namespace pineforge::detail
pineforge::detail::ScratchCapacityError
Definition
scratch_errors.hpp:114
pineforge::detail
Definition
array.hpp:46
pineforge::detail::kMaxResidentCohorts
constexpr std::size_t kMaxResidentCohorts
Definition
scratch_defaults.hpp:16
pineforge::detail::ScratchResource::layout
@ layout
Definition
scratch_errors.hpp:14
pineforge::detail::default_scratch_manifest
ScratchManifest default_scratch_manifest()
Definition
scratch_defaults.hpp:38
scratch_errors.hpp
scratch_tables.hpp
pineforge::detail::ScratchManifest
Definition
scratch_tables.hpp:15
include
pineforge
detail
scratch_defaults.hpp
PineForge unreleased — Apache-2.0 —
github.com/pineforge-4pass/pineforge-engine
—
pineforge.dev