-
Couldn't load subscription status.
- Fork 22
Pre commit update #620
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
Pre commit update #620
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
|
@KRRT7 tests failing |
…update`) The optimization introduces a **cached GitHub Actions detection mechanism** that eliminates repeated expensive environment lookups in the hot path. **Key optimization**: - Added `_in_github_actions_mode()` function with `@lru_cache(maxsize=1)` that caches the result of `env_utils.get_pr_number()` - Replaced the inline `bool(env_utils.get_pr_number())` call inside `speedup_critic` with a call to the cached function **Why this is faster**: The original code called `env_utils.get_pr_number()` on every invocation of `speedup_critic`. While `get_pr_number()` itself is cached, it still involves function call overhead and the boolean conversion. The line profiler shows this operation took **5.69ms** (28.8% of total time) in the original vs only **1.09ms** (7.7%) in the optimized version. **Performance characteristics**: - **Best for high-frequency scenarios**: The optimization shines when `speedup_critic` is called many times (as shown in the large-scale tests with 500+ candidates), where the 22% speedup compounds significantly - **Minimal impact on single calls**: For individual calls, the improvement is small but consistent - **GitHub Actions environments benefit most**: Since the cached result prevents repeated environment variable lookups that are expensive in CI environments The optimization maintains identical behavior while reducing redundant work through strategic caching of the GitHub Actions detection logic.
⚡️ Codeflash found optimizations for this PR📄 23% (0.23x) speedup for
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
PR Type
Enhancement
Description
Refresh lint config: bump ruff to v0.12.7, add UP045 ignore
Style fixes: added
return None, starred tuple unpack, removed unused importRefine critic signature: make parameter keyword-only default False
Add noqa to TestResults class, bump version placeholder
File Walkthrough