feat: Specialize pipeline types for performance
Introduces type specialization for reactive pipeline nodes and their data buffers. This eliminates the overhead of generic `Value` enums and `SharedValueSeries` when dealing with known scalar or record types. The architecture shifts buffer instantiation from the VM to the runtime (RTL), leveraging type information from the AST. A new `out_type` field is added to `BoundKind::Pipe` to store the static type of the pipeline's output, determined by the type checker. This enables the creation of specialized `RingBuffer<T>` and `SharedRecordSeries` (for Struct-of-Arrays layout) when the output type is known, significantly improving memory usage and processing speed for time-series data, especially in financial analysis.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
;; Benchmark: 1.9us
|
||||
;; Benchmark-Repeat: 1072
|
||||
;; Benchmark: 1.6us
|
||||
;; Benchmark-Repeat: 1233
|
||||
;; Output: [150 130 "Insufficient funds" 130]
|
||||
|
||||
; ---------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
;; Benchmark: 1.5us
|
||||
;; Benchmark-Repeat: 1367
|
||||
;; Test Record SoA specialization in Pipelines
|
||||
;; Dank der neuen Spezialisierung wird hierfür im Hintergrund
|
||||
;; eine SharedRecordSeries mit SoA-Layout (Float-Puffer für mid und range) erstellt.
|
||||
|
||||
(do
|
||||
(def ohlc_stream (create-random-ohlc 42 10))
|
||||
|
||||
;; Pipe die einen Record erzeugt
|
||||
(def indicator
|
||||
(pipe [ohlc_stream]
|
||||
(fn [ohlc]
|
||||
{
|
||||
:mid (/ (+ (.high ohlc) (.low ohlc)) 2.0)
|
||||
:range (- (.high ohlc) (.low ohlc))
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
indicator
|
||||
)
|
||||
Reference in New Issue
Block a user