-
Notifications
You must be signed in to change notification settings - Fork 311
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
[Sofa.Helper] Fix and micro-optimize AdvancedTimer #2349
Conversation
[ci-build][with-all-tests] |
[ci-depends-on] detected during build #6. To unlock the merge button, you must
|
const char* message; | ||
ScopedAdvancedTimer(const std::string& message); | ||
ScopedAdvancedTimer( const char* message ); | ||
AdvancedTimer::IdStep m_id; |
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 know this is not the topic of the PR and it is more about general c++ coding practice but including thousand of dependencies lines to get something that in fact is an integer is really problematic. I wonder what kind of design pattern should be used instead of these inner typedefs.
* [Sofa.Helper] Store id as an id rather than the message used to find the id * [Sofa.Helper] Use map for constant complexity instead of a std::vector * [SofaCore] Missing include * [SofaCore] Missing include * [SofaCore] Missing include * [SofaCore] Missing include
ScopedAdvancedTimer
, store the timer id as a real id rather than thestd::string
used to find the real id. This fixes a strange bug occurring withScopedAdvancedTimer
(which I am not able to explain).AdvancedTimer
, use a map for constant complexity when searching an id, instead of astd::vector
[ci-depends-on https://github.com/sofa-framework/Compliant/pull/2]
By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).
Reviewers will merge this pull-request only if