mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-25 05:48:06 +00:00
validation and profiles
This commit is contained in:
@@ -61,6 +61,20 @@ $$ M_n = \frac{1}{n} \sum_{i=1}^{n} x_i = \frac{(n-1) \cdot M_{n-1} + x_n}{n} $$
|
||||
|
||||
## Performance Profile
|
||||
|
||||
### Operation Count (Streaming Mode)
|
||||
|
||||
Cumulative Mean Arithmetic uses a simple running sum divided by count — no window, no buffer.
|
||||
|
||||
| Operation | Count | Cost (cycles) | Subtotal |
|
||||
| :--- | :---: | :---: | :---: |
|
||||
| Add value to running sum | 1 | 1 cy | ~1 cy |
|
||||
| Increment count | 1 | 1 cy | ~1 cy |
|
||||
| Divide sum by count | 1 | 4 cy | ~4 cy |
|
||||
| NaN guard + state update | 1 | 2 cy | ~2 cy |
|
||||
| **Total** | **O(1)** | — | **~8 cy** |
|
||||
|
||||
Cheapest mean variant — no buffer, no window management. Throughput limited by division latency (~4 cy on modern x86).
|
||||
|
||||
| Metric | Score | Notes |
|
||||
| :--- | :--- | :--- |
|
||||
| **Throughput** | ~5 ns/bar | Single division per update. |
|
||||
|
||||
Reference in New Issue
Block a user