Hi Team, Benoit Wiart has raised the following JIRA : https://issues.apache.org/jira/browse/FLEX-33865 (ConstraintLayout / LayoutElementHelper are memory inefficient and slow)
He also proposed a patch to optimize the performance and reduce memory allocations. On behalf on the Apache Flex team, I would like to thank him for the time he spent on that. This is my almost first patch validation and would like your advice: 1) The patch adds an optional arg to an existing method that returns an Array of 2 elements. The purpose of this arg is to preallocate an Array, and pass it to successive calls to avoid memory allocations. This certainly decreases the memory allocations, but at the same time makes the code less readable, and may also have an impact on other calls when the second arg is not used. 2) Patch introduces "inlined" code for trimming spaces, again to avoid unnecessary allocs when calling utils functions, which makes the code more verbose (final function is 2.5 longer than original). 3) Patch speed optimization is x4 in worst case (constraint layout parsing) and memory allocation is 4x lower, when calling the function 10,000 times. But I am not sure what the overall performance gain is. So my question is : What should be the criteria for accepting an optimization proposition ? - Code readability / maintenability vs. performance optimization - local performance gain vs. overall performance gain? - Optimization scope (that is, functions that are not often used) Can we also accept part of an optimization only ? Regards, Maurice