Quote:
Originally Posted by Robert_Zenz
* Always declare variables outside of Loops
|
Not necessary. The compiler will move the declare out of the loop in the real program. Declare your variables as close to where you will use them as possible and keep their scopes small for more readable, logical code
Quote:
|
* At very large collections use a normal For Loop instead of a For Each (one variable declaration less)
|
Using For Each sets up an enumeration which can be many hundreds of times faster at accessing a collection than a positional based indexer (Linked list for example must count 99 items before it can return you the hundredth, a LinkedList of 100 items iterated using a positional indexer must perform 5000 skips to return all items: don't do it).
Do not advocate positional indexing purely on a variable declaration saving (nanoseconds)
Quote:
|
* Try to avoid unnecessary calls
|
Again, nanoseconds, and youre advocating making code one huge long unreadable procedure for the sake of minor inlining performance (which the compiler will perform if it feels the need) gain. It's not worth it: readable code first!