-
Notifications
You must be signed in to change notification settings - Fork 117
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
Improve performance of type name demangling #277
Comments
|
I've compared the usage of std::regex_replace with an implementation based on std::string::replace (code) and the latter is significantly faster (~23x). But, after replacing all usage of regex_replace with my custom function in |
Good to know. I'm still in favor of doing this, but we can defer to later (and we'll have to figure out the other performance degradation). |
I've spent some time trying to cut down on string copies (e.g. using std::string::reserve, mutate operator "+=", removing temporary variables, using output parameters), but none of my attempts showed a significant improvement in performance. In fact, when I revert the change introduced in #266 I see slightly worse performance compared to the master branch.
I'm using the same benchmark from when this ticket was created. I'm not sure why I'm unable get the same result. Maybe it's because of the change in Fast-RTPS version since the ticket was opened? Or perhaps it was a fluke. I could probably come up with a better benchmark test. In any case, I think it makes sense to add the "find and replace" function to rcpputils so it can be re-used by multiple RMW implementations. |
Here are the related PRs that are eligible for backport into Dashing:
@clalancette I'm not convinced there is more performance improvement that can be made related to the type name demangling, so I'm closing this ticket. |
That's fine. We can always revisit and improve in the future if there is a need. |
Feature description
It was noticed in the addition of #266, that there was a performance hit, possibly due to the use of the
regex
library. See #266 (comment) for a discussion.A simple benchmark is timing the rcl graph tests before and after applying the change:
On my machine,
before: 03.06 seconds
after: 04.28 seconds
Implementation considerations
We should try replacing the usage of
regex
and cutting down on string copies (as suggested) to see if performance can be improved.The text was updated successfully, but these errors were encountered: