Optimize createSymbolDatabaseExprIds()#5017
Optimize createSymbolDatabaseExprIds()#5017firewave merged 2 commits intocppcheck-opensource:mainfrom
Conversation
|
This is a big win - it saves 15% of total Ir for The underlying run-time can be improved by using Boost (I still have changes utilizing that by default for the Windows release builds) and/or applying #4526. @danmar If you provide someone with binaries you should build them with |
|
Since
Yea instead of using this nested loop we can first check the tokens that do not have children. When it matches then we can check the astParent and then repeat. If it doesn't match we might still need to check the parent if its the same operator and its commutative(such as |
In this example, there are three expression tokens, Point being, maybe we can omit some expr tokens? |
Never, although we dont usualy check for side effects, this one seems obvious. Thats why if we start with the leaf nodes in the ast we can then skip operators like With the current algorithm, if we skip |
This is really a suggestion for a future PR. I think this PR can be merged as is. |
This gives a speedup of ~2x, but still scales as O(N^2).