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

Eliminate allocations in relative entropy cone #841

Merged
merged 5 commits into from
May 8, 2024
Merged

Eliminate allocations in relative entropy cone #841

merged 5 commits into from
May 8, 2024

Conversation

araujoms
Copy link
Contributor

@araujoms araujoms commented May 7, 2024

As far as I can tell this removes all unnecessary allocations, except the one cause by the following line in eig_dot_kron!

V_views = [view(V, :, i) for i in 1:size(inner, 1)]

and the corresponding line in d2zdV2!. I assume you're doing this for a reason, so I left it alone.

@chriscoey
Copy link
Collaborator

Nice. Out of curiosity have you noticed any change in solve times from this? I wouldn't expect a big difference, but it still seems worthwhile.

@araujoms
Copy link
Contributor Author

araujoms commented May 7, 2024

Not really. I did some benchmarking, and it did seem to improve a little bit, but it could be just noise.

I went through it because sometimes allocations indicate a performance-killing problem. Now I'm sure there's no problem 🙃

@chriscoey
Copy link
Collaborator

yeah for a case like this, the cost of some allocations is typically dominated by other computational costs. but this PR isn't adding a lot of opaque code or anything, so I'm happy for it to be merged. I guess if the user's machine is a bit memory constrained maybe it can help more.

@chriscoey
Copy link
Collaborator

I'll give @lkapelevich a chance to chime in. Then she or I can merge it in.

@araujoms
Copy link
Contributor Author

araujoms commented May 8, 2024

I've removed the mysterious vector of views, and the allocations are gone, with a very slight improvement in performance.

Copy link

codecov bot commented May 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.67%. Comparing base (96746e6) to head (614adfd).

❗ Current head 614adfd differs from pull request most recent head d323dfe. Consider uploading reports for the commit d323dfe to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #841      +/-   ##
==========================================
+ Coverage   91.61%   96.67%   +5.05%     
==========================================
  Files          55       56       +1     
  Lines        8590     9081     +491     
==========================================
+ Hits         7870     8779     +909     
+ Misses        720      302     -418     

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

@chriscoey
Copy link
Collaborator

Ok thanks I'll merge if it's ready

@araujoms
Copy link
Contributor Author

araujoms commented May 8, 2024

From my side it's ready.

@chriscoey chriscoey merged commit 2f4008f into jump-dev:master May 8, 2024
5 checks passed
@araujoms araujoms deleted the allocs branch May 8, 2024 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants