Expand description
§Leopard
A high-performance parallelized vector container library with deferred execution.
Leopard provides LVec, a parallel vector container that records operations and
executes them in a single bulk parallel pass. This design minimizes thread pool
creation overhead by batching all operations together.
§Key Features
- Deferred Execution: Operations are recorded between
LQueue::startandLQueue::end, then executed in one parallel batch - Type-Agnostic Queue: A single
LQueuecan manageLVec<T>of different types - SIMD-Style Masking: Boolean masks with blend, select, and masked operations
- Operator Overloading: Natural syntax with
+,-,*,/operators - Dependency Graph: Operations are automatically ordered based on data dependencies
§Quick Start
use leopard::{LQueue, LVec, LMask};
let q = LQueue::new();
let x: LVec<f64> = q.lvec_with_capacity(1000);
let y: LVec<f64> = q.lvec_with_capacity(1000);
q.start();
let x = x.fill_with(|i| i as f64);
let y = y.fill_with(|i| (i * 2) as f64);
let z = &x * &y + &x;
q.end();
let result = z.materialize().unwrap();§How It Works
-
Recording Phase: Between
q.start()andq.end(), operations create “pending”LVecinstances and push operation descriptors to the queue. -
Dependency Analysis: The queue builds a dependency graph to determine execution order.
-
Parallel Execution: At
q.end(), operations are executed level-by-level. Each operation uses Rayon’s parallel iterators for element-wise computation. -
Result Retrieval:
materialize()returns the computedArc<Vec<T>>for any pendingLVec.