From 006f5d16fd9e5a4010c0b1068a7b96fa35136a8c Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Wed, 26 Jul 2023 03:33:15 +0000 Subject: - Pack data closer to let config fit in 2 cache lines instead of 4. - Avoid plt indirection and allow more inlining of frequently called code. - Reapplication of #27646 --- eval/src/vespa/eval/eval/value_type.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'eval') diff --git a/eval/src/vespa/eval/eval/value_type.h b/eval/src/vespa/eval/eval/value_type.h index 49f88edb2f9..5c0d9e3317d 100644 --- a/eval/src/vespa/eval/eval/value_type.h +++ b/eval/src/vespa/eval/eval/value_type.h @@ -25,13 +25,13 @@ public: : name(name_in), size(npos) {} Dimension(const vespalib::string &name_in, size_type size_in) noexcept : name(name_in), size(size_in) {} - bool operator==(const Dimension &rhs) const { + bool operator==(const Dimension &rhs) const noexcept { return ((name == rhs.name) && (size == rhs.size)); } - bool operator!=(const Dimension &rhs) const { return !(*this == rhs); } - bool is_mapped() const { return (size == npos); } - bool is_indexed() const { return (size != npos); } - bool is_trivial() const { return (size == 1); } + bool operator!=(const Dimension &rhs) const noexcept { return !(*this == rhs); } + bool is_mapped() const noexcept { return (size == npos); } + bool is_indexed() const noexcept { return (size != npos); } + bool is_trivial() const noexcept { return (size == 1); } }; private: @@ -39,10 +39,10 @@ private: CellType _cell_type; std::vector _dimensions; - ValueType() + ValueType() noexcept : _error(true), _cell_type(CellType::DOUBLE), _dimensions() {} - ValueType(CellType cell_type_in, std::vector &&dimensions_in) + ValueType(CellType cell_type_in, std::vector &&dimensions_in) noexcept : _error(false), _cell_type(cell_type_in), _dimensions(std::move(dimensions_in)) {} static ValueType error_if(bool has_error, ValueType else_type); @@ -57,7 +57,7 @@ public: CellMeta cell_meta() const { return {_cell_type, is_double()}; } bool is_error() const { return _error; } bool is_double() const; - bool has_dimensions() const { return !_dimensions.empty(); } + bool has_dimensions() const noexcept { return !_dimensions.empty(); } bool is_sparse() const; bool is_dense() const; bool is_mixed() const; @@ -70,12 +70,12 @@ public: std::vector mapped_dimensions() const; size_t dimension_index(const vespalib::string &name) const; std::vector dimension_names() const; - bool operator==(const ValueType &rhs) const { + bool operator==(const ValueType &rhs) const noexcept { return ((_error == rhs._error) && (_cell_type == rhs._cell_type) && (_dimensions == rhs._dimensions)); } - bool operator!=(const ValueType &rhs) const { return !(*this == rhs); } + bool operator!=(const ValueType &rhs) const noexcept { return !(*this == rhs); } ValueType map() const; ValueType reduce(const std::vector &dimensions_in) const; -- cgit v1.2.3