From e04fc67aae800377537633aeebb2de3ac0af94a9 Mon Sep 17 00:00:00 2001 From: Username404-59 Date: Tue, 5 Oct 2021 09:15:46 +0200 Subject: [PATCH] Reserve memory for the Units vector --- src/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main.cpp b/src/main.cpp index c9240ec..af0e85c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -42,6 +42,7 @@ int main(int argc, char* argv[]) { if (!files.empty()) { vector>>> Units; const launch& Policy = not parallel ? launch::deferred : launch::async; + Units.reserve(files.size()); transform(files.begin(), files.end(), back_inserter(Units), [&Policy, &compile](const string_view& fileName){ return async(Policy, [&fileName, &compile]() { pair> resultingPair;