malort
9 years agoVisitor
Performance of creating ContentNode v. roArray/roAA
One thing to be cautious of is the performance of creating many nodes/contentNodes as they are quite a bit slower than the standard roArray/roAssociativeArray. See the example below
This is the time it took to create 2000 objects of each type.
The interesting bit is how long it took to create 2k BaseContentNodes as it's just a simple extended ContentNode with no additional fields/functions/children. The large content node had a lot of fields and functions.
I wonder if Roku is aware of this performance, and if this is going to be optimized in the future. No matter how you look at it, if you need to pass a lot of arbitrary data around, it's either going to be a bit slow to create the roSGNodes to use as a reference, or you end up running into performance issues with a deep-copy to read/modify arrays and associative arrays.
This is the time it took to create 2000 objects of each type.
CreateObject("roSGNode", "LargeContentNode") 1324ms
CreateObject("roSGNode", "BaseContentNode") 649ms
CreateObject("roSGNode", "ContentNode") 92ms
AssocArray: 3ms
Array: 4ms
The interesting bit is how long it took to create 2k BaseContentNodes as it's just a simple extended ContentNode with no additional fields/functions/children. The large content node had a lot of fields and functions.
<?xml version="1.0" encoding="utf-8" ?>
<component name="BaseContentNode" extends="ContentNode" />
I wonder if Roku is aware of this performance, and if this is going to be optimized in the future. No matter how you look at it, if you need to pass a lot of arbitrary data around, it's either going to be a bit slow to create the roSGNodes to use as a reference, or you end up running into performance issues with a deep-copy to read/modify arrays and associative arrays.