Performance Testing
by DaveSkender
Benchmark indicator performance with BenchmarkDotNet. Use for Series/Buffer/Stream benchmarks, regression detection, and optimization patterns. Target 1.5x Series for StreamHub, 1.2x for BufferList.
Skill Details
Repository Files
2 files in this skill directory
name: performance-testing description: Benchmark indicator performance with BenchmarkDotNet. Use for Series/Buffer/Stream benchmarks, regression detection, and optimization patterns. Target 1.5x Series for StreamHub, 1.2x for BufferList.
Performance testing
Running benchmarks
cd tools/performance
# Run all benchmarks (~15-20 minutes)
dotnet run -c Release
# Run specific category
dotnet run -c Release --filter *StreamIndicators*
dotnet run -c Release --filter *BufferIndicators*
dotnet run -c Release --filter *SeriesIndicators*
# Run specific indicator
dotnet run -c Release --filter *.EmaHub
Adding benchmarks
Series pattern
[Benchmark]
public void ToMyIndicator() => quotes.ToMyIndicator(14);
Stream pattern
[Benchmark]
public object MyIndicatorHub() => quoteHub.ToMyIndicatorHub(14).Results;
Buffer pattern
[Benchmark]
public MyIndicatorList MyIndicatorList() => new(14) { quotes };
Style comparison
[Benchmark]
public IReadOnlyList<MyResult> MyIndicatorSeries() => quotes.ToMyIndicator(14);
[Benchmark]
public IReadOnlyList<MyResult> MyIndicatorBuffer() => quotes.ToMyIndicatorList(14);
[Benchmark]
public IReadOnlyList<MyResult> MyIndicatorStream() => quoteHub.ToMyIndicator(14).Results;
Performance targets
Note: These are optimization goals for future v3.1+ effort. Current implementations vary—see PERFORMANCE_ANALYSIS.md for actual measured performance. Some indicator families (e.g., EMA) have inherent framework overhead due to simple operation costs.
| Style | Target vs Series | Use Case |
|---|---|---|
| Series | Baseline | Batch processing |
| BufferList | ≤ 1.2x | Incremental data |
| StreamHub | ≤ 1.5x | Real-time feeds |
Expected execution times (502 periods)
Note: These are optimization targets. Actual execution times vary by indicator complexity and current implementation.
| Complexity | Time | Examples |
|---|---|---|
| Fast | < 30μs | SMA, EMA, WMA, RSI |
| Medium | 30-60μs | MACD, Bollinger Bands, ATR |
| Complex | 60-100μs | HMA, ADX, Stochastic |
| Advanced | 100-200μs+ | Ichimoku, Hurst |
Regression detection
# Auto-detect baseline and results
pwsh detect-regressions.ps1
# Custom threshold (default 10%)
pwsh detect-regressions.ps1 -ThresholdPercent 15
Exit codes:
0- No regressions1- Regressions found
Creating baselines
cp BenchmarkDotNet.Artifacts/results/Performance.*-report-full.json \
baselines/baseline-v3.0.0.json
Required optimization patterns
- Minimize allocations in hot paths
- Avoid LINQ in performance-critical loops
- Use
Span<T>for zero-copy operations - Cache calculations when possible
- Test with realistic data sizes (502 periods)
Prohibited patterns
- Excessive LINQ in hot paths
- Boxing/unboxing of value types
- Unnecessary string allocations
- Redundant calculations in loops
- Poor cache locality
See references/benchmark-patterns.md for detailed patterns.
Last updated: December 31, 2025
Related Skills
Dbt Transformation Patterns
Master dbt (data build tool) for analytics engineering with model organization, testing, documentation, and incremental strategies. Use when building data transformations, creating data models, or implementing analytics engineering best practices.
Senior Data Scientist
World-class data science skill for statistical modeling, experimentation, causal inference, and advanced analytics. Expertise in Python (NumPy, Pandas, Scikit-learn), R, SQL, statistical methods, A/B testing, time series, and business intelligence. Includes experiment design, feature engineering, model evaluation, and stakeholder communication. Use when designing experiments, building predictive models, performing causal analysis, or driving data-driven decisions.
Hypogenic
Automated hypothesis generation and testing using large language models. Use this skill when generating scientific hypotheses from datasets, combining literature insights with empirical data, testing hypotheses against observational data, or conducting systematic hypothesis exploration for research discovery in domains like deception detection, AI content detection, mental health analysis, or other empirical research tasks.
Ux Researcher Designer
UX research and design toolkit for Senior UX Designer/Researcher including data-driven persona generation, journey mapping, usability testing frameworks, and research synthesis. Use for user research, persona creation, journey mapping, and design validation.
Hypogenic
Automated LLM-driven hypothesis generation and testing on tabular datasets. Use when you want to systematically explore hypotheses about patterns in empirical data (e.g., deception detection, content analysis). Combines literature insights with data-driven hypothesis testing. For manual hypothesis formulation use hypothesis-generation; for creative ideation use scientific-brainstorming.
Data Engineering Data Driven Feature
Build features guided by data insights, A/B testing, and continuous measurement using specialized agents for analysis, implementation, and experimentation.
Dbt Transformation Patterns
Master dbt (data build tool) for analytics engineering with model organization, testing, documentation, and incremental strategies. Use when building data transformations, creating data models, or implementing analytics engineering best practices.
Dashboard Design
USE THIS SKILL FIRST when user wants to create and design a dashboard, ESPECIALLY Vizro dashboards. This skill enforces a 3-step workflow (requirements, layout, visualization) that must be followed before implementation. For implementation and testing, use the dashboard-build skill after completing Steps 1-3.
Ux Researcher Designer
UX research and design toolkit for Senior UX Designer/Researcher including data-driven persona generation, journey mapping, usability testing frameworks, and research synthesis. Use for user research, persona creation, journey mapping, and design validation.
Data Stats Analysis
Perform statistical tests, hypothesis testing, correlation analysis, and multiple testing corrections using scipy and statsmodels. Works with ANY LLM provider (GPT, Gemini, Claude, etc.).
