From dd43cf2657330812c7118c2c88040105fc92b835 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 23 Nov 2020 12:29:22 +0100 Subject: AK: Use ALWAYS_INLINE all over NonnullPtrVector I saw NonnullOwnPtrVector::at() in a profile and that was silly, as we should definitely be inlining it. --- AK/NonnullPtrVector.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'AK/NonnullPtrVector.h') diff --git a/AK/NonnullPtrVector.h b/AK/NonnullPtrVector.h index 31b42102a5..7abbc26829 100644 --- a/AK/NonnullPtrVector.h +++ b/AK/NonnullPtrVector.h @@ -54,23 +54,23 @@ public: using ConstIterator = SimpleIterator; using Iterator = SimpleIterator; - constexpr ConstIterator begin() const { return ConstIterator::begin(*this); } - constexpr Iterator begin() { return Iterator::begin(*this); } + ALWAYS_INLINE constexpr ConstIterator begin() const { return ConstIterator::begin(*this); } + ALWAYS_INLINE constexpr Iterator begin() { return Iterator::begin(*this); } - constexpr ConstIterator end() const { return ConstIterator::end(*this); } - constexpr Iterator end() { return Iterator::end(*this); } + ALWAYS_INLINE constexpr ConstIterator end() const { return ConstIterator::end(*this); } + ALWAYS_INLINE constexpr Iterator end() { return Iterator::end(*this); } - PtrType& ptr_at(int index) { return Base::at(index); } - const PtrType& ptr_at(int index) const { return Base::at(index); } + ALWAYS_INLINE PtrType& ptr_at(int index) { return Base::at(index); } + ALWAYS_INLINE const PtrType& ptr_at(int index) const { return Base::at(index); } - T& at(int index) { return *Base::at(index); } - const T& at(int index) const { return *Base::at(index); } - T& operator[](int index) { return at(index); } - const T& operator[](int index) const { return at(index); } - T& first() { return at(0); } - const T& first() const { return at(0); } - T& last() { return at(size() - 1); } - const T& last() const { return at(size() - 1); } + ALWAYS_INLINE T& at(int index) { return *Base::at(index); } + ALWAYS_INLINE const T& at(int index) const { return *Base::at(index); } + ALWAYS_INLINE T& operator[](int index) { return at(index); } + ALWAYS_INLINE const T& operator[](int index) const { return at(index); } + ALWAYS_INLINE T& first() { return at(0); } + ALWAYS_INLINE const T& first() const { return at(0); } + ALWAYS_INLINE T& last() { return at(size() - 1); } + ALWAYS_INLINE const T& last() const { return at(size() - 1); } private: // NOTE: You can't use resize() on a NonnullFooPtrVector since making the vector -- cgit v1.2.3