-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Speedup Track Validation #33462
Merged
Merged
Speedup Track Validation #33462
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
7521e3f
speedup MTV and clusterAssoc
VinInn 10e7953
more speed
VinInn 0d5cab0
code format
VinInn 6044c2e
simplify
VinInn df1b086
add comment to remind to reserve when it will be possible
VinInn c7c1668
code checks AND format
VinInn b867dd5
fix order in tuple
VinInn d0efade
code format
VinInn b94fb38
refactorize, modernize
VinInn ec60154
more modern
VinInn 1f5f009
back to the messy include
VinInn 44e08c9
back to the messy include
VinInn File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef SimDataFormatsTrackUniqueSimTrackId_H | ||
#define SimDataFormatsTrackUniqueSimTrackId_H | ||
|
||
#include "FWCore/Utilities/interface/hash_combine.h" | ||
|
||
#include "SimDataFormats/EncodedEventId/interface/EncodedEventId.h" | ||
#include <tuple> | ||
|
||
using UniqueSimTrackId = std::pair<uint32_t, EncodedEventId>; | ||
struct UniqueSimTrackIdHash { | ||
std::size_t operator()(UniqueSimTrackId const &s) const noexcept { | ||
return edm::hash_value(s.first, s.second.rawId()); | ||
} | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
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.
@VinInn , sorry I may be miss something but the same definition is in the header and here in the source.
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.
which definition?
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.
I did not modify any header
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.
I am sorry, the correct question: the same code included both inside SimHitTPAssociationProducer.cc and ClusterTPAssociationProducer.cc
namespace {
using TkId = std::pair<uint32_t, EncodedEventId>;
struct TkIdHash {
std::size_t operator()(TkId const& s) const noexcept {
std::size_t h1 = std::hash<uint32_t>{}(s.first);
std::size_t h2 = std::hash<uint32_t>{}(s.second.rawId());
return h1 ^ (h2 << 1);
}
};
} // namespace
I understand , that it is a correct and the most performant variant but Is it unavoidable to repeat these lines in each producer? For curiosity, how much you win?
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.
yes, can be factorized somewhere. (Where?)
What I win is that I will not need to recompile the whole universe (if I include it in EncodedEventId for instance) and I do not pollute the global namespace.
Actually I do not know where to locate it .... Any suggestion? One has to avoid additional dependencies (and of course the name shall be changed to be more unique etc)
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.
Given the dependence chain (
SimTrack::trackId()
,EncodedEventId
), a new header inSimDataFormats/Track/interface
could be somewhat natural place.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.
Any suggestion for the name of the alias of the pair and for the hash struct (and the file itself)?
I hope that alias and struct can be located in the same file....
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.
Just thinking out loud , maybe something along
SimTrackAndEventId
,SimTrackAndEncodedEventId
,SimTrackEventIdPair
(all with...Hash
)?I'm not super happy with any of them though (and more often than not I find good names difficult to come up).
Given the usage I don't see strong motivations to use different files.
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.
What about: UniqueSimTrackId (or SimTrackUniqueId) ?
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.
I would be fine with either,
UniqueSimTrackId
sounds maybe a bit better.