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

move constructors #2003

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from
Draft

move constructors #2003

wants to merge 5 commits into from

Conversation

dellaert
Copy link
Member

@dellaert dellaert commented Jan 25, 2025

I added move constructors for GaussianConditional, JacobianFactor, and VerticalBlockMatrix, hoping to see a performance difference, but if anything it made it worse. Below are timings for timeBatch and timeSFMBAL, where

  • Before is without any move constructors
  • After is without VerticalBlockMatrix move constructors (just GaussianConditional, JacobianFactor)
  • After2 is with VerticalBlockMatrix move constructors
image

After is 2% more expensive, and After2 restores that to "about the same".

Any ideas, e.g., @ProfFan ?

@@ -470,7 +470,7 @@ std::shared_ptr<GaussianConditional> HessianFactor::eliminateCholesky(const Orde

// TODO(frank): pre-allocate GaussianConditional and write into it
const VerticalBlockMatrix Ab = info_.split(nFrontals);
conditional = std::make_shared<GaussianConditional>(keys_, nFrontals, Ab);
conditional = std::make_shared<GaussianConditional>(keys_, nFrontals, std::move(Ab));
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 is called many times. I had hoped this would make a performance difference.

@ProfFan
Copy link
Collaborator

ProfFan commented Jan 25, 2025

image

@ProfFan
Copy link
Collaborator

ProfFan commented Jan 25, 2025

these two timing scripts are probably too small for any perf benefits to show up

Currently a lot of time is spent in

    Scatter scatter(factors, keys);
    jointFactor = std::make_shared<HessianFactor>(factors, scatter);

@dellaert
Copy link
Member Author

Hmmm, weird. All right, I’ll use instruments to profile.

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