Skip to content

Add shared rolling-window engine for consistency and performance #18

@TDamiao

Description

@TDamiao

Goal

Introduce a shared rolling-window engine to improve performance consistency and reduce duplicated math logic.

Why

Multiple indicators can reuse the same rolling primitives (mean/std/min/max/sum), reducing bug surface and warmup drift.

Implementation prompt

Create internal rolling core (e.g., src/core/rolling.ts) with reusable stateful + batch helpers:

  • rolling sum/mean
  • rolling std
  • rolling min/max
  • warmup-aware null behavior

Refactor selected indicators to use rolling core where it improves clarity/performance.

Scope

  • Internal module first (no immediate public API required)
  • Deterministic semantics matching current outputs
  • Micro-benchmarks before/after for key indicators

Acceptance criteria

  • No behavioral regression in golden tests
  • Reduced duplicated rolling logic in overlap/volatility modules
  • Benchmarks show equal or better performance on 10k/100k runs
  • Dev notes document warmup/alignment invariants

Test plan

  • Existing test suite + golden unchanged outputs
  • New unit tests for rolling primitives and edge windows
  • Benchmark comparison report attached to PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra help is welcome from the community.performanceBenchmarks, profiling, and runtime optimization work.v0.4Release gate work required before shipping v0.4.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions