keep a static vector to avoid memory allocation 70/242970/3
authorSubhransu Mohanty <sub.mohanty@samsung.com>
Wed, 2 Sep 2020 06:47:22 +0000 (15:47 +0900)
committerSubhransu Mohanty <sub.mohanty@samsung.com>
Tue, 6 Oct 2020 01:04:02 +0000 (10:04 +0900)
Change-Id: I3ada71c7fd7d5d4ede47f769cc81723e22ac3a77

dali/internal/update/rendering/scene-graph-renderer.cpp

index bbfa7ae..e821f6e 100644 (file)
@@ -49,8 +49,14 @@ MemoryPoolObjectAllocator<Renderer> gRendererMemoryPool;
 void AddMappings( CollectedUniformMap& localMap, const UniformMap& uniformMap )
 {
   // Iterate thru uniformMap.
-  //   Any maps that aren't in localMap should be added in a single step
-  CollectedUniformMap newUniformMappings;
+  // Any maps that aren't in localMap should be added in a single step
+
+  // keep a static vector to avoid temporary heap allocation.
+  // As this function gets called only from update thread we don't have to
+  // make it thread safe (so no need to keep a thread_local variable).
+  static CollectedUniformMap newUniformMappings;
+
+  newUniformMappings.Clear();
 
   for( UniformMap::SizeType i = 0, count=uniformMap.Count(); i<count; ++i )
   {