⚡️ Speed up function bisection_method by 36%
#127
Closed
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.
📄 36% (0.36x) speedup for
bisection_methodinsrc/numpy_pandas/numerical_methods.py⏱️ Runtime :
1.35 milliseconds→998 microseconds(best of77runs)📝 Explanation and details
Changes made:
f(a)andf(b)at the start and updated them within the loop, as their values only change whenaorbchanges, respectively.fis expensive to compute.✅ Correctness verification report:
🌀 Generated Regression Tests and Runtime
🔎 Concolic Coverage Tests and Runtime
codeflash_concolic_214ll97i/tmpmfpfcrsk/test_concolic_coverage.py::test_bisection_methodcodeflash_concolic_214ll97i/tmpmfpfcrsk/test_concolic_coverage.py::test_bisection_method_2codeflash_concolic_214ll97i/tmpmfpfcrsk/test_concolic_coverage.py::test_bisection_method_3To edit these changes
git checkout codeflash/optimize-bisection_method-mh1684nrand push.