Skip to content

Conversation

@misrasaurabh1
Copy link
Contributor

@misrasaurabh1 misrasaurabh1 commented Oct 28, 2025

PR Type

Enhancement


Description

  • Reduce pytest max loops from 100000 to 250

  • Speed up benchmarking/test iteration limits


Diagram Walkthrough

flowchart LR
  RunTests["run_and_parse_tests()"] -- uses --> pytest_max_loops["pytest_max_loops=250"]
  pytest_max_loops -- limits --> TestLooping["Pytest looping iterations"]
  TestLooping -- speeds up --> Benchmarking["Benchmark runtime"]
Loading

File Walkthrough

Relevant files
Enhancement
function_optimizer.py
Cap pytest loops to 250 for faster runs                                   

codeflash/optimization/function_optimizer.py

  • Lower pytest_max_loops default to 250.
  • Intended to cap test iterations for faster runs.
+1/-1     

@github-actions
Copy link

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Behavior Change

Lowering pytest_max_loops from 100_000 to 250 may alter test/benchmark outcomes and early-stop scenarios; verify that long-running or flaky tests relying on higher iteration ceilings still behave correctly.

pytest_max_loops: int = 250,
code_context: CodeOptimizationContext | None = None,
Configurability

Consider whether 250 should be configurable via env/CLI to allow project-specific tuning without code changes, especially for CI vs local benchmarking.

pytest_max_loops: int = 250,
code_context: CodeOptimizationContext | None = None,

@github-actions
Copy link

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Avoid premature loop capping

Lowering the default pytest_max_loops from a very high value to 250 may prematurely
cap runs for large or flaky test suites, potentially yielding unstable or incorrect
benchmarking results. Consider making this cap adaptive or preserving a higher
default while allowing faster paths to override it.

codeflash/optimization/function_optimizer.py [1889]

-pytest_max_loops: int = 250,
+pytest_max_loops: int = 100_000,
Suggestion importance[1-10]: 4

__

Why: The suggestion accurately points to the changed default (pytest_max_loops set to 250) and raises a reasonable concern about potential premature capping, but proposes simply reverting to 100_000 without context or adaptive logic; impact is minor to moderate and correctness is arguable based on project intent.

Low

Copy link
Contributor

@KRRT7 KRRT7 left a comment

Choose a reason for hiding this comment

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

LGTM, though this limits it for all test cases, not certain ones I'd say

@KRRT7 KRRT7 enabled auto-merge October 28, 2025 21:47
@KRRT7 KRRT7 merged commit a41d7cf into main Oct 28, 2025
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants