Skip to content

Commit a4a45db

Browse files
committed
avoid progress-related hot spot in ValueFlowPassRunner::run() [skip ci]
1 parent be6e4a1 commit a4a45db

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lib/valueflow.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7212,7 +7212,10 @@ struct ValueFlowPassRunner {
72127212
values = getTotalValues();
72137213
const std::string passnum = std::to_string(state.settings.vfOptions.maxIterations - n + 1);
72147214
if (std::any_of(passes.begin(), passes.end(), [&](const ValuePtr<ValueFlowPass>& pass) {
7215-
ProgressReporter progressReporter(state.errorLogger, state.settings.reportProgress, state.tokenlist.getSourceFilePath(), std::string("ValueFlow::") + pass->name() + (' ' + passnum));
7215+
// the string concatination is a hot spot in TestIO::testScanfArgument and TestIO::testPrintfArgumentVariables
7216+
const bool doProgress = state.settings.reportProgress >= 0;
7217+
std::string stage = doProgress ? std::string("ValueFlow::") + pass->name() + (' ' + passnum) : "";
7218+
ProgressReporter progressReporter(state.errorLogger, state.settings.reportProgress, state.tokenlist.getSourceFilePath(), std::move(stage));
72167219
return run(pass);
72177220
}))
72187221
return true;

0 commit comments

Comments
 (0)