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

Use @timeit on function calls #956

Merged
merged 2 commits into from
Dec 10, 2024

Conversation

gnawin
Copy link
Member

@gnawin gnawin commented Dec 10, 2024

Related issues

Closes #934

  • Remove EnergyProblem.timings
  • Use @timeit on function calls

Checklist

  • I am following the contributing guidelines

  • Tests are passing

  • Lint workflow is passing

  • Docs were updated and workflow is passing

Copy link
Member

@abelsiqueira abelsiqueira left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @gnawin !

@gnawin
Copy link
Member Author

gnawin commented Dec 10, 2024

@abelsiqueira @datejada After checking the time log log.txt for the Tiny case, here are a few observations:

  • create_interna_structures is 27.6% of the time, which seems mostly spent on the functions related to reading tables (e.g., TulipaIO.get_table, DBInterface.execute). Probably there is nothing we can do better, but interesting to see.
  • compute_dual_variables is 3 times more expensive than total solver time. Seeing the code, it makes sense, but still, good to realize.

Copy link

codecov bot commented Dec 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.83%. Comparing base (73f765e) to head (60da05b).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #956      +/-   ##
==========================================
- Coverage   95.91%   95.83%   -0.08%     
==========================================
  Files          29       29              
  Lines        1027     1008      -19     
==========================================
- Hits          985      966      -19     
  Misses         42       42              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gnawin gnawin merged commit 8d91801 into TulipaEnergy:main Dec 10, 2024
6 of 7 checks passed
@gnawin gnawin deleted the 934-use-timeit-on-functions branch December 10, 2024 11:09
@abelsiqueira
Copy link
Member

Nice insights. We should definitely do that as part of the efficiency improvement for the EU dataset

@datejada
Copy link
Member

Thanks @gnawin; the compute duals will change once we change how to store the solution and hopefully, it will be faster than the current approach 😄

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.

Try using @timeit to on function calls, not on begin ... end blocks
3 participants