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
Use move semantics to push TrajectorySeeds into a vector #3693
Conversation
A new Pull Request was created by @mark-grimes (Mark Grimes) for CMSSW_7_1_X. Use move semantics to push TrajectorySeeds into a vector It involves the following packages: RecoTracker/TkSeedGenerator @nclopezo, @cmsbuild, @anton-a, @thspeer, @slava77, @Degano can you please review it and eventually sign? Thanks. |
@@ -159,7 +159,7 @@ void SeedFromConsecutiveHitsCreator::buildSeed( | |||
PTrajectoryStateOnDet const & PTraj = | |||
trajectoryStateTransform::persistentState(updatedState, hit->geographicalId().rawId()); | |||
TrajectorySeed seed(PTraj,std::move(seedHits),alongMomentum); | |||
if ( !filter || filter->compatible(seed)) seedCollection.push_back(seed); | |||
if ( !filter || filter->compatible(seed)) seedCollection.push_back(std::move(seed)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a different solution could be
seedCollection.emplace_back(PTraj,std::move(seedHits),alongMomentum);
if (filter && (!filter->compatible(seedCollection.back()) seedCollection.pop_back();
in particular if compatible is very likely
is anyone willing to compare the performance of the proposed solution and Vincenzo's alternative or we stick with the original proposal? It would have helped to have some benchmark numbers. |
+1 |
RecoTracker/TkSeedGenerator -- Use move semantics to push TrajectorySeeds into a vector
TrajectorySeed has a move constructor (https://github.com/cms-sw/cmssw/blob/CMSSW_7_1_X/DataFormats/TrajectorySeed/interface/TrajectorySeed.h#L65) which previously wasn't used for the vector push.
I haven't done any benchmarking, but each individual push_back should be quite small. At 140 pileup however pixelPairStepSeeds has O(100000) of these push_backs, and that's just one of the tracking steps.