Skip to content

Commit

Permalink
perf: Drop stateBuffer from Core CKF (#3458)
Browse files Browse the repository at this point in the history
I noticed that we recreate this buffer for every `findTracks` call which seems to be a massive overhead at the moment. Not sure if we want to pass it in from outside or just use the given container to store these temporary states in. The user will copy out the track and clear the container anyways which keeps memory allocated and should leave enough space for consecutive calls.
  • Loading branch information
andiwand authored Aug 19, 2024
1 parent 00d84ee commit e6b73b5
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,6 @@ struct CombinatorialKalmanFilterResult {
/// Indices into `tracks` which mark active branches
std::vector<TrackProxy> collectedTracks;

/// This is used internally to store candidate trackstates
std::shared_ptr<TrackStateContainerBackend> stateBuffer;

/// Track state candidates buffer
std::vector<TrackStateProxy> trackStateCandidates;

Expand Down Expand Up @@ -364,8 +361,6 @@ class CombinatorialKalmanFilter {
trackStateCandidates.reserve(std::distance(slBegin, slEnd));
}

bufferTrajectory.clear();

// Calibrate all the source links on the surface since the selection has
// to be done based on calibrated measurement
for (auto it = slBegin; it != slEnd; ++it) {
Expand Down Expand Up @@ -734,7 +729,7 @@ class CombinatorialKalmanFilter {
Acts::Result<CkfTypes::BranchVector<TrackIndexType>>;
TrackStatesResult tsRes = trackStateCandidateCreator(
state.geoContext, *calibrationContextPtr, *surface, boundState,
slBegin, slEnd, prevTip, *result.stateBuffer,
slBegin, slEnd, prevTip, *result.trackStates,
result.trackStateCandidates, *result.trackStates, logger());
if (!tsRes.ok()) {
ACTS_ERROR(
Expand Down Expand Up @@ -1290,7 +1285,6 @@ class CombinatorialKalmanFilter {
.template get<CombinatorialKalmanFilterResult<track_container_t>>();
r.tracks = &trackContainer;
r.trackStates = &trackContainer.trackStateContainer();
r.stateBuffer = std::make_shared<TrackStateContainerBackend>();

auto rootBranch = trackContainer.makeTrack();
r.activeBranches.push_back(rootBranch);
Expand Down

0 comments on commit e6b73b5

Please sign in to comment.