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).
|
Do you still see 2x improvement with cppcheck with this change? |
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). |
Ok, I see 1.5x improvement as well for release build. The debug build is only about 7% faster. |
My measurements were on release build. I didn't try in debug. ;-) |
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).