From 55d1d6abbb0d4a38038b4b8af3cbbd70a975c339 Mon Sep 17 00:00:00 2001 From: Ben Boeckel <ben.boeckel@kitware.com> Date: Tue, 23 Jan 2018 18:36:55 -0500 Subject: [PATCH] CollapseFullPath: reserve space for components The number of input components is a good hint for the number of output components. --- SystemTools.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SystemTools.cxx b/SystemTools.cxx index 53cd02c..2be4c98 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -3200,6 +3200,7 @@ std::string SystemTools::CollapseFullPath(const std::string& in_path, // Split the input path components. std::vector<std::string> path_components; SystemTools::SplitPath(in_path, path_components); + out_components.reserve(path_components.size()); // If the input path is relative, start with a base path. if (path_components[0].empty()) { @@ -3262,6 +3263,7 @@ std::string SystemTools::CollapseFullPath(const std::string& in_path, // Split the input path components. std::vector<std::string> path_components; SystemTools::SplitPath(in_path, path_components); + out_components.reserve(path_components.size()); // If the input path is relative, start with a base path. if (path_components[0].length() == 0) { -- GitLab