Skip to content

Commit 87098f7

Browse files
committed
perf: Enable TBB parallelization unconditionally in HessianFactor
Remove conditional check for GTSAM_TBB_BOUNDED_MEMORY_GROWTH_FLAG to always enable TBB parallelization when GTSAM_USE_TBB is defined. Improves optimizer performance on my test case with 12 cores by ~27% (117.2s -> 85.7s) by reducing iteration times from ~5-6s to ~3s. Before: ``` Running gtsam optimizer took 117.2392 seconds ``` After: ``` Running gtsam optimizer took 85.6852 seconds ```
1 parent 5013e2a commit 87098f7

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

gtsam/linear/HessianFactor.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -253,12 +253,7 @@ HessianFactor::HessianFactor(const GaussianFactorGraph& factors,
253253
Allocate(scatter);
254254
gttoc(Allocate);
255255

256-
// Only parallelize the inner loop if GTSAM_TBB_BOUNDED_MEMORY_GROWTH_FLAG is
257-
// defined. Without this flag, multiple HessianFactor constructions are
258-
// already running in parallel (e.g., when constructing multiple factors
259-
// concurrently), so there's no need to parallelize the inner
260-
// updateHessian loop here as well.
261-
#if defined(GTSAM_USE_TBB) && defined(GTSAM_TBB_BOUNDED_MEMORY_GROWTH_FLAG)
256+
#if defined(GTSAM_USE_TBB)
262257
constexpr DenseIndex kParallelThresholdHeuristic = 50;
263258
if (info_.rows() > kParallelThresholdHeuristic) {
264259
gttic(updateHessian_TBB);

0 commit comments

Comments
 (0)