Skip to content

optimized isSameConstantValue() a bit#4441

Merged
danmar merged 1 commit into
cppcheck-opensource:mainfrom
firewave:ast
Sep 5, 2022
Merged

optimized isSameConstantValue() a bit#4441
danmar merged 1 commit into
cppcheck-opensource:mainfrom
firewave:ast

Conversation

@firewave
Copy link
Copy Markdown
Collaborator

@firewave firewave commented Sep 5, 2022

tok is known to be non-null since we check it at the beginning in the function so we can perform a lighter check first.

Scanning mame_regtest with --enable=all --inconclusive and DISABLE_VALUEFLOW=1 it reduces the amount of calls (not instructions!) of the match function by almost half:

match51(Token const*) - 1 130 084 -> 690 156

Clang 14 1,901,904,224 -> 1,901,377,920

@danmar danmar merged commit 436b8bd into cppcheck-opensource:main Sep 5, 2022
@firewave firewave deleted the ast branch September 5, 2022 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants