Skip to content

astutils.h: reserve std::vector space in visitAstNodes() to avoid excess allocations#4158

Merged
danmar merged 1 commit intocppcheck-opensource:mainfrom
firewave:stack-perf
Jun 3, 2022
Merged

astutils.h: reserve std::vector space in visitAstNodes() to avoid excess allocations#4158
danmar merged 1 commit intocppcheck-opensource:mainfrom
firewave:stack-perf

Conversation

@firewave
Copy link
Copy Markdown
Collaborator

@firewave firewave commented May 31, 2022

This is an intermediate solution until SmallVector is able to avoid these allocation when not utilizing Boost. As it already provides a sizable improvement without the need for any external dependency I decided to go with this for now.

Testing an -O2 build with --enable=all --inconclusive on mame_regtest code (with some additional local speed hacks applied):
GCC 11 37,875,483,481 -> 33,842,501,109
Clang 13 35,459,791,724 -> 28,694,901,787

@firewave firewave changed the title astutils.h: reserve std::vector space in visitAstNodes() to avoid excess allocations astutils.h: reserve std::vector space in visitAstNodes() to avoid excess allocations May 31, 2022
@danmar danmar merged commit cc08a66 into cppcheck-opensource:main Jun 3, 2022
@firewave firewave deleted the stack-perf branch June 3, 2022 17:28
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