[Bf-blender-cvs] [d49f1f8772a] functions: don't inline grow functions

Jacques Lucke noreply at git.blender.org
Fri Aug 23 17:35:46 CEST 2019


Commit: d49f1f8772adfe6feb7091146684c9d2e0280959
Author: Jacques Lucke
Date:   Fri Aug 23 16:52:24 2019 +0200
Branches: functions
https://developer.blender.org/rBd49f1f8772adfe6feb7091146684c9d2e0280959

don't inline grow functions

===================================================================

M	source/blender/blenlib/BLI_map.hpp
M	source/blender/blenlib/BLI_set.hpp
M	source/blender/blenlib/BLI_set_vector.hpp

===================================================================

diff --git a/source/blender/blenlib/BLI_map.hpp b/source/blender/blenlib/BLI_map.hpp
index 79af0146282..16130e2fc4b 100644
--- a/source/blender/blenlib/BLI_map.hpp
+++ b/source/blender/blenlib/BLI_map.hpp
@@ -561,12 +561,12 @@ template<typename KeyT, typename ValueT, typename Allocator = GuardedAllocator>
 
   void ensure_can_add()
   {
-    if (m_array.should_grow()) {
+    if (UNLIKELY(m_array.should_grow())) {
       this->grow(this->size() + 1);
     }
   }
 
-  void grow(uint32_t min_usable_slots)
+  BLI_NOINLINE void grow(uint32_t min_usable_slots)
   {
     ArrayType new_array = m_array.init_reserved(min_usable_slots);
     for (Item &old_item : m_array) {
diff --git a/source/blender/blenlib/BLI_set.hpp b/source/blender/blenlib/BLI_set.hpp
index 3bdb3629a58..2b76d1ed23c 100644
--- a/source/blender/blenlib/BLI_set.hpp
+++ b/source/blender/blenlib/BLI_set.hpp
@@ -421,12 +421,12 @@ template<typename T, typename Allocator = GuardedAllocator> class Set {
 
   void ensure_can_add()
   {
-    if (m_array.should_grow()) {
+    if (UNLIKELY(m_array.should_grow())) {
       this->grow(this->size() + 1);
     }
   }
 
-  void grow(uint32_t min_usable_slots)
+  BLI_NOINLINE void grow(uint32_t min_usable_slots)
   {
     // std::cout << "Grow at " << m_array.slots_set() << '/' << m_array.slots_total() << '\n';
     ArrayType new_array = m_array.init_reserved(min_usable_slots);
diff --git a/source/blender/blenlib/BLI_set_vector.hpp b/source/blender/blenlib/BLI_set_vector.hpp
index f938b7da19e..a78efe0e676 100644
--- a/source/blender/blenlib/BLI_set_vector.hpp
+++ b/source/blender/blenlib/BLI_set_vector.hpp
@@ -300,12 +300,12 @@ template<typename T, typename Allocator = GuardedAllocator> class SetVector {
 
   void ensure_can_add()
   {
-    if (m_array.should_grow()) {
+    if (UNLIKELY(m_array.should_grow())) {
       this->grow(this->size() + 1);
     }
   }
 
-  void grow(uint min_usable_slots)
+  BLI_NOINLINE void grow(uint min_usable_slots)
   {
     ArrayType new_array = m_array.init_reserved(min_usable_slots);



More information about the Bf-blender-cvs mailing list