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/buffer.cc | 2 +- src/buffer_manager.cc | 2 +- src/buffer_manager.hh | 5 ++-- src/client.cc | 4 +-- src/client.hh | 8 ++--- src/client_manager.cc | 10 +++---- src/client_manager.hh | 10 +++---- src/commands.cc | 8 ++--- src/diff.hh | 4 +-- src/highlighter.cc | 2 +- src/highlighter.hh | 7 ++--- src/highlighter_group.cc | 2 +- src/highlighter_group.hh | 4 +-- src/highlighters.cc | 76 ++++++++++++++++++++++++------------------------ src/hook_manager.cc | 6 ++-- src/hook_manager.hh | 7 ++--- src/input_handler.cc | 2 +- src/main.cc | 18 ++++++------ src/option_manager.cc | 4 +-- src/option_manager.hh | 14 ++++----- src/regex_impl.cc | 4 +-- src/regex_impl.hh | 6 ++-- src/register_manager.cc | 2 +- src/register_manager.hh | 12 ++++---- src/remote.cc | 4 +-- src/remote.hh | 13 ++++----- src/terminal_ui.hh | 4 +-- src/unique_ptr.hh | 69 +++++++++++++++++++++++++++++++++++++++++++ src/utils.hh | 11 +------ src/value.hh | 4 +-- 30 files changed, 190 insertions(+), 134 deletions(-) create mode 100644 src/unique_ptr.hh (limited to 'src') diff --git a/src/buffer.cc b/src/buffer.cc index 9a735aaf..5c7d26fa 100644 --- a/src/buffer.cc +++ b/src/buffer.cc @@ -87,7 +87,7 @@ void Buffer::on_registered() m_flags &= ~Flags::NoBufSetOption; for (auto& option : options().flatten_options() - | transform(&std::unique_ptr