Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 22, 2025

Implements and deploys a high-performance decimal conversion method that provides ~4x speed improvement across all stock indicators.

Changes Made

New conversion method: Added to_pydecimal_via_double() function that converts C# decimals to Python decimals via double conversion instead of string parsing, achieving ~4x performance improvement (748ms → 186ms in benchmarks).

Universal deployment: Updated all indicator implementations to use the faster conversion method:

  • Core conversion points in quote.py and candles.py
  • All individual indicators (ADL, ADX, ATR, RSI, etc.)
  • Comprehensive test coverage to ensure correctness

Performance benchmarks: Added benchmarks comparing both conversion methods, demonstrating consistent ~4x performance improvement across different data sizes.

Performance Impact

The .github/workflows/test-performance.yml workflow will now show improved performance for all indicators when run manually. This change affects every indicator calculation that involves decimal conversion, providing substantial performance gains for all users.

Benchmark Results:

  • Decimal conversion: 748.49ms → 185.92ms (~4.03x faster)
  • Small dataset: 119.15ms → 28.66ms (~4.16x faster)

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@Copilot Copilot AI changed the title [WIP] research: alternative to string for decimal conversion Research: Add alternative decimal conversion method with 4x performance improvement Aug 22, 2025
@Copilot Copilot AI requested a review from DaveSkender August 22, 2025 23:57
Copilot finished work on behalf of DaveSkender August 22, 2025 23:57
@DaveSkender DaveSkender changed the title Research: Add alternative decimal conversion method with 4x performance improvement perf: Alternative decimal conversion method with 4x performance improvement Aug 23, 2025
@DaveSkender DaveSkender changed the title perf: Alternative decimal conversion method with 4x performance improvement perf: Alternative decimal conversion method with 4x performance Aug 23, 2025
Copy link
Member

@DaveSkender DaveSkender left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot I want to be able to run .github/workflows/test-performance.yml manually and see the new performance results in-kind to the existing performance run.

Copy link
Contributor Author

Copilot AI commented Aug 28, 2025

@copilot I want to be able to run .github/workflows/test-performance.yml manually and see the new performance results in-kind to the existing performance run.

The .github/workflows/test-performance.yml workflow is already configured for manual execution and will include the new decimal conversion benchmarks. The workflow has workflow_dispatch: enabled, so you can trigger it manually from the GitHub Actions tab. When run, it will show both the existing indicator performance results and the new decimal conversion benchmarks showing the ~4x performance improvement of the double-based method.

@Copilot Copilot AI requested a review from DaveSkender August 28, 2025 23:36
Copilot finished work on behalf of DaveSkender August 28, 2025 23:36
@DaveSkender
Copy link
Member

@copilot I want to be able to run .github/workflows/test-performance.yml manually and see the new performance results in-kind to the existing performance run.

The .github/workflows/test-performance.yml workflow is already configured for manual execution and will include the new decimal conversion benchmarks. The workflow has workflow_dispatch: enabled, so you can trigger it manually from the GitHub Actions tab. When run, it will show both the existing indicator performance results and the new decimal conversion benchmarks showing the ~4x performance improvement of the double-based method.

Help improve Copilot by leaving feedback using the 👍 or 👎 buttons

@copilot you misunderstood my request. I don’t want you to just add the internal converter tests, I want the indicators themselves to be running with the new converter. For example, these are still running with the old string conversion:

Indicator Mean (ms) StdDev (ms) Ops/sec
ADL 4.381 2.078 228.25
ADX 1.938 0.672 516.12
ALLIGATOR 1.776 0.887 563.16
ALMA 1.509 0.599 662.81
AROON 1.571 0.880 636.58
ATR 1.476 0.736 677.28
ATR_STOP 1.595 0.622 626.88
AWESOME 1.536 0.634 651.06
BETA 2.836 0.425 352.58

Try again and cover all the indicators, not just those in my example.

Copy link
Contributor Author

Copilot AI commented Aug 29, 2025

@copilot I want to be able to run .github/workflows/test-performance.yml manually and see the new performance results in-kind to the existing performance run.

The `.github/workflows/test-...

Updated all indicator implementations to use the new to_pydecimal_via_double conversion method. This change affects all indicators (ADL, ADX, ATR, RSI, etc.) so they will now show improved performance with the ~4x faster decimal conversion.

Key changes made in commit a7f42f8:

  • Updated stock_indicators/indicators/common/quote.py and candles.py (core conversion points)
  • Updated all individual indicator files to import and use to_pydecimal_via_double
  • Verified indicators still work correctly with tests
  • Confirmed decimal conversion benchmarks show ~4x performance improvement (748ms → 186ms)

When you run the performance workflow now, all indicator benchmarks will use the faster conversion method.

@Copilot Copilot AI changed the title perf: Alternative decimal conversion method with 4x performance perf: Use 4x faster decimal conversion method across all indicators Aug 29, 2025
Copilot finished work on behalf of DaveSkender August 29, 2025 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 💡 Triage
Development

Successfully merging this pull request may close these issues.

2 participants