For ... in Delphi execution?

How does Delphi's performance for ... in a loop compare to traditional 1st loop performance?

Is this just syntactic sugar that makes your code easier to read / potentially less buggy as it lacks loop counter variables that could be disabled by one? Or are you also getting actual performance benefits (like pipelining or multithreading), since the results of individual loops are not guaranteed to be calculated in a specific order?

+3


source to share


1 answer


Stefan Glienke wrote on his blog about measuring loop performance.

TL; DR:



  • The performance of the classic for-for-in-loop is almost the same (after some optimization)
  • [...] the compiler generates terrible code when you use inline with the results of managed functions [...]

  • Some code in RTL is far from perfect

  • The 32-bit compiler has many optimization possibilities

0


source







All Articles