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

Avoid Matrix::diagonal and limit progress bar updates #47

Merged
merged 3 commits into from
Oct 25, 2024

Conversation

matt-graham
Copy link
Collaborator

From some profiling

  • Matrix-vector multiplications using %*% with Matrix::Diagonal appear to be much slower than just using a diagonal matrix constructed with diag even though nominally this incurs an unecessary quadratic rather than linear cost.
  • Progress bar updates become bottleneck when chain iterations are very fast.

This PR therefore switches to using diag in place of Matrix::Diagonal and limiting progress bar updates to every 10% (or every 1 iteration if less than 10 iterations).

Copy link

codecov bot commented Oct 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (5d29b85) to head (1d3fe26).
Report is 18 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #47   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           11        11           
  Lines          480       483    +3     
=========================================
+ Hits           480       483    +3     

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

@matt-graham matt-graham merged commit 4321d29 into main Oct 25, 2024
11 checks passed
@matt-graham matt-graham deleted the mmg/performance-improvements branch October 25, 2024 13:48
@matt-graham matt-graham added the enhancement New feature or request label Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant