• Create Account

### #ActualImprecision

Posted 29 April 2012 - 06:02 PM

[...]

Remember, if it is a trivial and safe transformation, the compiler writers will probably have already implemented it.

I don't count on that since I've read that this:

int length = List.Count
for (int i = 0; i < length; i++
{
//Run through list
}


is several times faster than

for (int i = 0; i < List.Count; i++
{
//Run through list
}


One line of code optimization.

Finally, are you sure you need all these variables? For optimisation, the fastest code is the code that doesn't have to run. Perhaps some of these values are actually redundant.

It generates a planet chunk with curvature, trianglelist, heighmap and textures coordinates at once. Yes I need that many variables

But thanks for all your answers. Now I'm able to clean up my code a bit

### #1Imprecision

Posted 29 April 2012 - 06:01 PM

[...]

Remember, if it is a trivial and safe transformation, the compiler writers will probably have already implemented it.

I don't count on that since I've read that this:

int length = List.Count
for (int i = 0; i < length; i++
{
//Run through list
}


is several times faster than

for (int i = 0; i < List.Count; i++
{
//Run through list
}


One line of code optimization.

Finally, are you sure you need all these variables? For optimisation, the fastest code is the code that doesn't have to run. Perhaps some of these values are actually redundant.

It generates a planet chunk with curvature, trianglelist, heighmap and textures coordinates at once. Yes I need that many variables

PARTNERS