Skip to content

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

Merged
danmar merged 1 commit into
cppcheck-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 into
cppcheck-opensource:mainfrom
firewave:stack-perf

Conversation

@firewave

@firewavefirewave commented May 31, 2022

Copy link
Copy Markdown
Collaborator

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

@firewavefirewave changed the title astutils.h: reserve std::vector space in visitAstNodes() to avoid excess allocationsastutils.h: reserve std::vector space in visitAstNodes() to avoid excess allocationsMay 31, 2022
@danmar
danmar merged commit cc08a66 into cppcheck-opensource:mainJun 3, 2022
@firewave
firewave deleted the stack-perf branch June 3, 2022 17:28
Sign up for freeto 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

@firewave@danmar