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

Optimize code to replace the df #452

Merged
merged 14 commits into from
Jul 10, 2024
Merged

Optimize code to replace the df #452

merged 14 commits into from
Jul 10, 2024

Conversation

Kaniyaki
Copy link
Contributor

No description provided.

@codecov
Copy link

codecov bot commented Apr 1, 2023

Codecov Report

Attention: Patch coverage is 82.35294% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/estimagic/parameters/check_constraints.py 73.91% 6 Missing ⚠️
Files with missing lines Coverage Δ
tests/parameters/test_check_constraints.py 100.00% <100.00%> (ø)
src/estimagic/parameters/check_constraints.py 87.39% <73.91%> (-0.57%) ⬇️

@Kaniyaki
Copy link
Contributor Author

Kaniyaki commented Apr 1, 2023

Optimized the "check_fixes_and_bounds" function, which originally had a runtime of 5.61 ms.
The main problem was that it used DataFrame.
Instead of it, I used a dictionary and added the "_iloc" function as a substitute for DataFrame.iloc. Current runtime is 55 µs, which is a significant improvement.
In the end, I made sure that all tests passed, and they did.
Below, you can see the comparison for the runtime using %timeit and %lprun.
lprun_comparison.pdf
timeit_comparison.pdf

@Kaniyaki Kaniyaki marked this pull request as ready for review April 1, 2023 15:20
Copy link
Member

@janosg janosg left a comment

Choose a reason for hiding this comment

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

Again, sorry for the delay. Great work, just polished it a bit.

@janosg janosg merged commit 424fdda into main Jul 10, 2024
17 checks passed
@janosg janosg deleted the performance-changes branch July 10, 2024 09:25
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.

3 participants