- Home /
Is for loop caching worth it in unity3d Mono Develop
Did anybody tested this yet.
With caching
for (var i = 0, len = Array.length; i < len; i++) {
}
Without caching
for (var i = 0; i < Array.length; i++) {
}
Comment
Best Answer
Answer by Jamora · Sep 18, 2013 at 04:40 PM
The results are the same. The C# List source code shows that it contains a private int field for size, so the only overhead is an additional method call, which on modern computers border on nothing.
i guess this was already asked before but not in unity3d and not C#
Javascript version of for loop caching
thanks didn't expect it to be the same in c# though.
Your answer
Follow this Question
Related Questions
Get child position from last gameobject in array 2 Answers
How do I alternate the colors of my Chessboard? 2 Answers
Clicker game instantiate prefab depending on gold per click 0 Answers
Glitch in Monodevelop for loops!!! 1 Answer
Array Syntax Issue 2 Answers