Uh oh!
There was an error while loading. Please reload this page.
Remove usage of std::vector and getArguments from getTokenArgumentFunction - #3435
Conversation
…ction getTokenArgumentFunction can be called many many times, and the vector is not needed, but it can become quite costly. This patch replaces getArguments with a function simply returning the position of the token, if it is found in the arguments (thus saving the cost of std::vector).
pfultz2
commented
Aug 31, 2021
Do you still see 2x improvement with cppcheck with this change? |
Ken-Patrick
commented
Aug 31, 2021
I probably was a bit optimistic about 2x, probably more like 1.5x (at least on the file I tested, I will test more thoroughly if I can find the time), so yes clear improvement (and std::vector disappears from my callgrind profile). |
pfultz2
commented
Aug 31, 2021
Ok, I see 1.5x improvement as well for release build. The debug build is only about 7% faster. |
Ken-Patrick
commented
Aug 31, 2021
My measurements were on release build. I didn't try in debug. ;-) |
danmar
commented
Sep 1, 2021
great! |
getTokenArgumentFunction can be called many many times, and the vector
is not needed, but it can become quite costly.
This patch replaces getArguments with a function simply returning the
position of the token, if it is found in the arguments (thus saving the
cost of std::vector).