From 763afe6f5f8462c69647b44ab9b2d2dba2e18d96 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 31 Jan 2020 12:24:16 +0100 Subject: [PATCH] util: store std::string_view in "final_components" vector Don't copy those path segments - instead, use std::string_view to store references into the existing std::strings. This saves a good amount of allocation overhead. --- src/util.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/util.cc b/src/util.cc index 341c8412e7..db91af4f54 100644 --- a/src/util.cc +++ b/src/util.cc @@ -1555,7 +1555,8 @@ TEST_CASE("util normalize_path") string normalize_path(const std::string_view path) { size_t n; - vector components, final_components; + vector components; + vector final_components; string new_path; new_path.reserve(path.size());