From 8e0c914a68f2d113fbfcfb730b94fe6cdb5e0e0c Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Fri, 24 Jan 2025 14:29:44 +0100 Subject: Add native comparison of configured targets ... and use it when normalizing the origins of actions. For this task, any well-defined linear order is sufficient. Using a native comparision (rather than comparing the canonical serialisation) significantly speeds up that normalisation process, as the assumption that it would be rare that an action has more than one origin turned out to be false. In fact, we have seeen cases where this sorting used to take several seconds before this change, so that this change reduced analysis time by more than a factor of 5. --- src/buildtool/build_engine/expression/configuration.hpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/buildtool/build_engine/expression/configuration.hpp') diff --git a/src/buildtool/build_engine/expression/configuration.hpp b/src/buildtool/build_engine/expression/configuration.hpp index ec3fde66..dadb71d2 100644 --- a/src/buildtool/build_engine/expression/configuration.hpp +++ b/src/buildtool/build_engine/expression/configuration.hpp @@ -16,6 +16,7 @@ #define INCLUDED_SRC_BUILDTOOL_BUILD_ENGINE_EXPRESSION_CONFIGURATION_HPP #include +#include #include #include #include @@ -92,6 +93,10 @@ class Configuration { return expr_ == other.expr_; } + [[nodiscard]] auto operator<(const Configuration& other) const -> bool { + return expr_->ToHash() < other.expr_->ToHash(); + } + [[nodiscard]] auto hash() const noexcept -> std::size_t { return std::hash{}(expr_); } -- cgit v1.2.3