Improve execution performance in RequestManager validation and Execution.has_ended#60
Open
pedroigorjs wants to merge 5 commits into
Open
Improve execution performance in RequestManager validation and Execution.has_ended#60pedroigorjs wants to merge 5 commits into
pedroigorjs wants to merge 5 commits into
Conversation
Coverage Report
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Coverage Report
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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
This PR improves rule execution performance by reducing overhead in two hot paths:
pandera-based DataFrame validation inRequestManager.validate()with a lightweight pandas-based validation flowExecution.has_ended()by switching from a full null-count scan to a short-circuit null checkWhat Changed
RequestManagerpandera.DataFrameSchemastrExecutionhas_ended()from.isna().sum() == 0tonot .isna().any()RequestManagertest to match the new lightweight schema representationMotivation
The goal is to reduce validation overhead during rule execution, especially in smaller and latency-sensitive workloads where fixed framework costs dominate total runtime.
Local performance notes in the repository indicate that input validation was one of the main execution bottlenecks, and that
has_ended()is called repeatedly during execution. These changes target both paths directly.Testing
poetry run pytest tests/test_engine/test_request_manager.pyRisks
"","null"and"None"are now treated as null-like values during DataFrame validationpandera, those values were accepted as valid stringsNotes
This PR is intentionally small and focused on committed performance changes only:
has_ended()short-circuit optimization