Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schedule 'force_special_times=True' performance optimization #358

Merged
merged 7 commits into from
Jan 5, 2025

Conversation

jack-of-some-trades
Copy link
Contributor

When force_special_times is True, the special_times are applied to other columns by editing an intermediate pandas Series Object. This was changed so that the code now edits an intermediate numpy array which is slightly more performant.

This change is most noticeable when generating longer schedules, or calendars that have re-occurring special times (such as XTAE's early sunday close)

Average NYSE Schedule Generation Time [2000-01-01 -> 2025-01-01]

force_special_times = True False None
No Optimizations 214.3ms (+38%) 173.0ms (+14%) 121.6ms (~0%*)
_tryholidays() Optimization (PR #357) 188.0ms (+21%) 152.8ms (~0%*) 118.6ms (~0%*)
_tryHolidays() & _adj_others Optimization 155.4ms ( - ) 151.5ms ( - ) 122.8ms ( - )

* These numbers should, in theory, be identical to their values in the last row. Random variations in execution time are causing the small discrepancies

@rsheftel
Copy link
Owner

I see you closed this without merging, is there a reason for that?

@rsheftel rsheftel reopened this Dec 14, 2024
@jack-of-some-trades
Copy link
Contributor Author

jack-of-some-trades commented Dec 14, 2024 via email

@rsheftel
Copy link
Owner

rsheftel commented Dec 14, 2024 via email

Changed ValueError on overlapping session to a warning and added as system for escalating date_range warnings to errors.

Added/adjusted relevant tests
- Docstring updated
- Updated and Expanded Tests
@rsheftel rsheftel merged commit 33d1555 into rsheftel:dev Jan 5, 2025
31 checks passed
@rsheftel
Copy link
Owner

rsheftel commented Jan 5, 2025

This is great, thanks for your work.

@jack-of-some-trades
Copy link
Contributor Author

No problem! There are still a few other (hopefully smaller) things along the same vein i might add here soon. They're things I personally could use, but fit well in the scope of your library so I figured I'd add them as contributions instead.

@rsheftel
Copy link
Owner

rsheftel commented Jan 6, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants