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

Minor optimizations and improvements #173

Merged
merged 4 commits into from
Mar 14, 2024
Merged

Conversation

bvdmitri
Copy link
Member

@bvdmitri bvdmitri commented Mar 13, 2024

This PR

  • Removes a special structure for UnspecifiedConstraints and simply uses Constraints (UnspecifiedConstraints is a const now)
  • Removes a special structure for BetheFactorization and simply uses UnspecifiedConstraints
  • Add a clarification to MeanField, that it does not respect default_constraint
  • Improves the allocation profile in some places by doing more operations in place rather than allocating a new BitSet matrices (checked on a simple model on RxInfer)
  • Moved "Apply MeanField constraints" and "Apply BetheFactorization constraints" to a separate file

Note: Benchmarks show that getorcreate! is significantly slower (and only in case of 1), I don't believe it and it seems like a noise. I didn't touch this part of the code, so it should not become slower or faster.

image

Would be nice if you could double check it @wouterwln

@bvdmitri bvdmitri requested a review from wouterwln March 13, 2024 14:52
Vector{FactorizationConstraint}[],
Vector{PosteriorFormConstraint}[],
Vector{MessageFormConstraint}[],
Vector{FactorizationConstraint}(),
Copy link
Member Author

Choose a reason for hiding this comment

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

This actually a funny one @wouterwln , not sure who of us made this mistake, but it basically created a vector of vector of constraints instead of just vector of constraints. It somehow worked though (probs some weird convert mechanics)

Copy link

codecov bot commented Mar 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.74%. Comparing base (918bbbc) to head (4bc587a).
Report is 7 commits behind head on dev-4.0.0.

Additional details and impacted files
@@              Coverage Diff              @@
##           dev-4.0.0     #173      +/-   ##
=============================================
+ Coverage      91.69%   91.74%   +0.04%     
=============================================
  Files             14       14              
  Lines           1795     1781      -14     
=============================================
- Hits            1646     1634      -12     
+ Misses           149      147       -2     

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

@wouterwln
Copy link
Member

On my machine getorcreate was also slower, but this was already before my implementation of MeanField. I thought it was noise as well so I merged, but there might be more stuff going on? In any case. It shouldn't matter as long as pipeline benchmarks aren't affected

@bvdmitri bvdmitri merged commit e98d5e2 into dev-4.0.0 Mar 14, 2024
5 checks passed
@wouterwln wouterwln deleted the dev-minor-optimizations branch March 20, 2024 13:12
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.

2 participants