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:
@@ -386,7 +386,7 @@ impl Optimizer {
|
||||
)
|
||||
}
|
||||
|
||||
BoundKind::Pipe { inputs, lambda } => {
|
||||
BoundKind::Pipe { inputs, lambda, out_type } => {
|
||||
let mut o_inputs = Vec::with_capacity(inputs.len());
|
||||
for input in inputs {
|
||||
o_inputs.push(self.visit_node(input, sub, path));
|
||||
@@ -396,6 +396,7 @@ impl Optimizer {
|
||||
BoundKind::Pipe {
|
||||
inputs: o_inputs,
|
||||
lambda: o_lambda,
|
||||
out_type: out_type.clone(),
|
||||
},
|
||||
node.ty.clone(),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user