From ce1d512a0c1922ab5f43f28e7bae573508c98601 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 8 Jul 2025 11:43:17 +1000 Subject: Replace std::unique_ptr with a custom implementation is a costly header we can avoid by just implementing UniquePtr ourselves, which is a pretty straightforward in modern C++, this saves around 10% of the compilation time here. --- src/regex_impl.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/regex_impl.cc') diff --git a/src/regex_impl.cc b/src/regex_impl.cc index 8a46d833..f64fc7a9 100644 --- a/src/regex_impl.cc +++ b/src/regex_impl.cc @@ -1046,7 +1046,7 @@ private: template [[gnu::noinline]] - std::unique_ptr compute_start_desc() const + UniquePtr compute_start_desc() const { CompiledRegex::StartDesc start_desc{}; if (compute_start_desc(0, start_desc) or @@ -1056,7 +1056,7 @@ private: if (std::count(std::begin(start_desc.map), std::end(start_desc.map), true) == 1) start_desc.start_byte = find(start_desc.map, true) - std::begin(start_desc.map); - return std::make_unique(start_desc); + return make_unique_ptr(start_desc); } void optimize(size_t begin, size_t end) -- cgit v1.2.3