From 50724e3d6a5aaedc6b2b8a5f57d1a53f172e8da9 Mon Sep 17 00:00:00 2001 From: Chris Speciale Date: Wed, 10 Jul 2024 13:49:43 -0400 Subject: [PATCH] BatchProcessor: Fix Class Map Uses an ObjectMap in place of a Dictionary. I'm not sure if this is better or not. I know Dictionaries have been shown to be quite slow, but we're also working with Dynamic key's here, so it might be in the same boat. --- src/starling/rendering/BatchProcessor.hx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/starling/rendering/BatchProcessor.hx b/src/starling/rendering/BatchProcessor.hx index 1c36c24..3510a08 100644 --- a/src/starling/rendering/BatchProcessor.hx +++ b/src/starling/rendering/BatchProcessor.hx @@ -14,7 +14,7 @@ import starling.display.Mesh; import starling.display.MeshBatch; import starling.utils.MeshSubset; import starling.utils.ArrayUtil; -import haxe.ds.Map; +import haxe.ds.ObjectMap; /** This class manages a list of mesh batches of different types; * it acts as a "meta" MeshBatch that initiates all rendering. @@ -183,10 +183,10 @@ class BatchProcessor { } class BatchPool { - private var _batchLists:Map, Array>; + private var _batchLists:ObjectMap>; public function new() { - _batchLists = new Map, Array>(); + _batchLists = new ObjectMap(); } public function purge():Void { @@ -207,10 +207,10 @@ class BatchPool { } public function get(styleType:Class):MeshBatch { - var batchList:Array = _batchLists[styleType]; + var batchList:Array = _batchLists.get(styleType); if (batchList == null) { batchList = new Array(); - _batchLists[styleType] = batchList; + _batchLists.set(styleType, batchList); } if (batchList.length > 0) @@ -221,7 +221,7 @@ class BatchPool { public function put(meshBatch:MeshBatch):Void { var styleType:Class = meshBatch.style.type; - var batchList:Array = _batchLists[styleType]; + var batchList:Array = _batchLists.get(styleType); if (batchList == null) { batchList = new Array(); _batchLists.set(styleType, batchList);