Fix performance issue in UpdateManager::AddNode() 20/251020/2
authorSubhransu Mohanty <sub.mohanty@samsung.com>
Thu, 7 Jan 2021 03:11:27 +0000 (12:11 +0900)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Mon, 25 Jan 2021 10:09:16 +0000 (10:09 +0000)
As node pointes are allocated by FixedMeomrySizedPool and the pool
allocates pages and page can be allocated at any location by global new.
it won't help with cache locality by keeping nodes in sorted order by address.

creating 100,000 actor takes 3 Second and 200,000 actor takes 11 Second .

Change-Id: Ic3b0da35ebd98d994d876083ffe3ee44f082d8c0

dali/internal/update/manager/update-manager.cpp

index f60bbdf..4cb0dec 100644 (file)
@@ -378,20 +378,11 @@ void UpdateManager::AddNode( OwnerPointer<Node>& node )
 {
   DALI_ASSERT_ALWAYS( nullptr == node->GetParent() ); // Should not have a parent yet
 
-  // Nodes must be sorted by pointer
   Node* rawNode = node.Release();
   DALI_LOG_INFO( gLogFilter, Debug::General, "[%x] AddNode\n", rawNode );
 
-  Vector<Node*>::Iterator begin = mImpl->nodes.Begin();
-  for( Vector<Node*>::Iterator iter = mImpl->nodes.End()-1; iter >= begin; --iter )
-  {
-    if( rawNode > (*iter) )
-    {
-      mImpl->nodes.Insert((iter+1), rawNode );
-      rawNode->CreateTransform( &mImpl->transformManager );
-      return;
-    }
-  }
+  mImpl->nodes.PushBack(rawNode);
+  rawNode->CreateTransform(&mImpl->transformManager);
 }
 
 void UpdateManager::ConnectNode( Node* parent, Node* node )