Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On top of #214, this moves
parameter_blocks
out of the loop that adds the residual blocks to theceres::Problem
created with the graph constraints.This turns out to be a marginal improvement. Indeed, the CPU time is roughly the same according to the benchmark results:
The numbers of allocations and allocated memory goes down for the
![heaptrack-allocated-Screenshot from 2020-12-02 22-19-23](https://user-images.githubusercontent.com/382167/100993063-36a1d580-3555-11eb-8aca-4f16a148fc81.png)
![heaptrack-allocations-Screenshot from 2020-12-02 22-19-02](https://user-images.githubusercontent.com/382167/100993065-373a6c00-3555-11eb-9adc-700aa6805d23.png)
![heaptrack-Screenshot from 2020-12-02 22-12-10](https://user-images.githubusercontent.com/382167/100993067-37d30280-3555-11eb-8962-2ef07051bab3.png)
![heaptrack-Screenshot from 2020-12-02 22-16-25](https://user-images.githubusercontent.com/382167/100993069-37d30280-3555-11eb-8a1c-a5d9bda18a74.png)
parameter_blocks
vector, but that wasn't the main contributor to memory allocations infuse_graphs::HashGraph::createProblem
:When compared with the results in #214, we have the following for the benchmark executable:
It's a big improvement for
parameter_blocks
alone, but almost nothing overall. And almost no impact on CPU time. But I believe it's a good change.