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/option_manager.hh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/option_manager.hh') diff --git a/src/option_manager.hh b/src/option_manager.hh index c36aeb6d..cf51fc5d 100644 --- a/src/option_manager.hh +++ b/src/option_manager.hh @@ -10,8 +10,8 @@ #include "vector.hh" #include "format.hh" #include "string_utils.hh" +#include "unique_ptr.hh" -#include #include namespace Kakoune @@ -121,7 +121,7 @@ private: // the only one allowed to construct a root option manager friend class Scope; friend class OptionsRegistry; - using OptionMap = HashMap, MemoryDomain::Options>; + using OptionMap = HashMap, MemoryDomain::Options>; OptionMap m_options; OptionManager* m_parent; @@ -268,13 +268,13 @@ public: : format("[{}] - {}", option_type_name(Meta::Type{}), docstring); m_descs.emplace_back(new OptionDesc{name.str(), std::move(doc), flags}); return *opts.insert({m_descs.back()->name(), - std::make_unique>(m_global_manager, *m_descs.back(), value)}); + make_unique_ptr>(m_global_manager, *m_descs.back(), value)}); } const OptionDesc* option_desc(StringView name) const { auto it = find_if(m_descs, - [&name](const std::unique_ptr& opt) + [&name](const UniquePtr& opt) { return opt->name() == name; }); return it != m_descs.end() ? it->get() : nullptr; } @@ -284,11 +284,11 @@ public: CandidateList complete_option_name(StringView prefix, ByteCount cursor_pos) const; void clear_option_trash() { m_option_trash.clear(); } - void move_to_trash(std::unique_ptr