perf(factors): optimize rolling operators and bench path#376
Merged
Conversation
Closes #339 Original implementation from #342 by @shadowinlife. Maintainer integration keeps the bottleneck and numpy operator fast paths, vectorized base equity calculation, and bench parallelism while initializing large bench inputs once per worker process, preserving custom registry injection by using sequential mode for injected registries, removing the unused Hypothesis dev dependency, and quieting all-NaN ts_rank warnings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
bottleneck/NumPy fast paths for hot factor operators:ts_rank,ts_argmax,ts_argmin, anddecay_linear.registry=injection by using sequential mode for injected registries, handle invalid worker env values, suppress all-NaNts_rankruntime warnings, and remove the unusedhypothesisdev dependency.Credit
Original performance implementation from #342 by @shadowinlife. This maintainer integration keeps the contribution and tightens the parallel execution and dependency edges before merge.
Closes #339
Refs #342
Validation
python -m pip install --target /tmp/vibe-pr342-bn-only --no-deps "bottleneck>=1.3.7" -qPYTHONPATH=/tmp/vibe-pr342-bn-only:agent pytest agent/tests/test_factor_operators.py agent/tests/test_bench_parallel.py agent/tests/test_equity_regression.py -q-> 50 passedVIBE_TRADING_DISABLE_BOTTLENECK=1 PYTHONPATH=/tmp/vibe-pr342-bn-only:agent pytest agent/tests/test_factor_operators.py -q-> 38 passedpython -m compileall -q agent/backtest/engines/base.py agent/scripts/bench_performance.py agent/src/factors/_backend.py agent/src/factors/base.py agent/src/factors/bench_runner.pygit diff --checkPYTHONPATH=/tmp/vibe-pr342-bn-only:agent python agent/scripts/bench_performance.py