Hi
I am writing a rendering program that does not use direct3D, it odes it all itself. Obviously when doing this I need to keep my code lean and fast so I have a few questions.
If I have an array of say 3000 pointers and I sometimes I need to do an operation when looping through that array and sometimes I don't which is quicker:
do{
statement 1;
if x{
statement 2;
}
}
Or:
do{
statement 1;
}
if x{
do{
statement 2;
}
}
in other words should I do the same if statement 3000 times or should I loop through 3000 times.
I assume that an array is better performance wise than a linked list. If I am using an array is it faster to have an array of pointers or an array of actual objects. I do need to swap items in teh array which I believe is faster if the array holds pointers as I simply swap the pointer but is it slow looping through an array of pointers?
Errm, I think that's it for now. Hope you can help.
Thanks
Giles Giles Roadnight
messenger: giles_roadnight@hotmail.com
ICQ: 81621370
I am writing a rendering program that does not use direct3D, it odes it all itself. Obviously when doing this I need to keep my code lean and fast so I have a few questions.
If I have an array of say 3000 pointers and I sometimes I need to do an operation when looping through that array and sometimes I don't which is quicker:
do{
statement 1;
if x{
statement 2;
}
}
Or:
do{
statement 1;
}
if x{
do{
statement 2;
}
}
in other words should I do the same if statement 3000 times or should I loop through 3000 times.
I assume that an array is better performance wise than a linked list. If I am using an array is it faster to have an array of pointers or an array of actual objects. I do need to swap items in teh array which I believe is faster if the array holds pointers as I simply swap the pointer but is it slow looping through an array of pointers?
Errm, I think that's it for now. Hope you can help.
Thanks
Giles Giles Roadnight
messenger: giles_roadnight@hotmail.com
ICQ: 81621370