Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit handles unnecessary work with array.
Making unused items of array to default makes us iterate other all array every time, this slows work of our application dramatically. I believe, that you should do this somehow the other way.
At least, if you want to ensure handling refs, check if your item is valueType, so you would not iterate other all array trying to set defaults which slower CPU. Anyway I believe that only when array is destroyed, working with its items stops in your app.
Also, you should compare sizes not with items.Length, but with Capacity.
I believe that you could handle working with your exposed list more accurately in individual cases.
By the way we work with il2cpp in our app and this leads to some slowing CPU cases while working with your arrays.
if you build app with il2cpp, there would be various code generations for null-checks, array boundary checks and etc during working with arrays. You could see Il2CppSetOptionAttribute in unity docs. This leads us to huge slowing of CPU work during iterations other array and etc. If you are sure you are working with arrays correctly, in what I believe (check your algorithms), you could turn off this code generation in il2cpp. This made work with our app faster up to 4-6 times. Especially during working with clipping zones and animations.
I am sure that you could find much more cases there you could make your Spine Runtime much faster.
Just check work with arrays and il2cpp build cases.