From 22d5c87910792e3694dd44c1cf500d823557fea6 Mon Sep 17 00:00:00 2001
From: Guilherme Amadio <amadio@cern.ch>
Date: Fri, 10 May 2019 08:20:42 +0200
Subject: [PATCH] Revert "[RVec] Further refine SBO code to improve
 performance"

This reverts commit 9e38c8905d4ef0bf71ac05f05cd9289abbe9b450.
---
 math/vecops/inc/ROOT/RVec.hxx | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/math/vecops/inc/ROOT/RVec.hxx b/math/vecops/inc/ROOT/RVec.hxx
index 299f3ad02c2..2aa0f7a1158 100644
--- a/math/vecops/inc/ROOT/RVec.hxx
+++ b/math/vecops/inc/ROOT/RVec.hxx
@@ -318,7 +318,7 @@ public:
    using const_iterator = typename Impl_t::const_iterator;
    using reverse_iterator = typename Impl_t::reverse_iterator;
    using const_reverse_iterator = typename Impl_t::const_reverse_iterator;
-   static constexpr std::size_t fgBufferSize = std::is_arithmetic<T>::value && !fgIsVecBool ? 16 : 0;
+   static constexpr std::size_t fgBufferSize = std::is_arithmetic<T>::value && !fgIsVecBool ? 32 : 0;
 
 private:
    // We need this class for the case where fgBufferSize is 0, otherwise array<NonCopiable, 0>
@@ -346,9 +346,17 @@ private:
    /// The default storage std::vector, initialised with the allocator
    Impl_t fData{fAlloc};
 
+   bool CanUseBuffer(std::size_t s)
+   {
+      const auto thisBufSize = ::ROOT::Detail::VecOps::GetBufferSize(fAlloc);
+      return thisBufSize && s <= thisBufSize;
+   }
    bool CanUseBuffer(const RVec &v)
    {
       const auto thisBufSize = ::ROOT::Detail::VecOps::GetBufferSize(fAlloc);
+      const auto otherBufSize = ::ROOT::Detail::VecOps::GetBufferSize(v.fAlloc);
+      if (thisBufSize == 0 && otherBufSize == 0)
+         return false;
       return thisBufSize && v.size() <= thisBufSize;
    }
 
-- 
GitLab