Refactor documentation to remove "Zero-Allocation Design" sections across various trend indicators and implement a PowerShell script for automated cleanup

- Updated mathematical foundations and performance profiles where necessary to maintain clarity and coherence.
This commit is contained in:
Miha Kralj
2025-12-21 14:37:44 -08:00
parent 54c309e5cf
commit a7b7207801
65 changed files with 1766 additions and 482 deletions
+1 -14
View File
@@ -14,7 +14,7 @@ The naive implementation of SMA sums $N$ numbers at every step, resulting in $O(
### O(1) Running Sum
We maintain a running `Sum` and a `RingBuffer` of history.
A running `Sum` and a `RingBuffer` of history are maintained.
$$ Sum_{new} = Sum_{old} - Value_{oldest} + Value_{new} $$
$$ SMA = \frac{Sum_{new}}{N} $$
@@ -38,19 +38,6 @@ $$ SMA_t = \frac{1}{N} \sum_{i=0}^{N-1} P_{t-i} $$
The implementation is optimized for both streaming (latency) and batch (throughput) scenarios.
### Zero-Allocation Design
The `RingBuffer` is pre-allocated at initialization. All updates are performed in-place using scalar operations or SIMD intrinsics, ensuring no heap allocations occur during the hot path.
| Metric | Score | Notes |
| :--- | :--- | :--- |
| **Throughput** | High | Optimized running sum |
| **Complexity** | O(1) | Constant time update |
| **Accuracy** | 5/10 | Baseline accuracy, unweighted |
| **Timeliness** | 4/10 | Significant lag (N/2) |
| **Overshoot** | 8/10 | Generally stable, no projection |
| **Smoothness** | 6/10 | Susceptible to "drop-off" effect |
## Validation
Validated against TA-Lib (`TA_SMA`) and Skender.Stock.Indicators.