struct structvector { float v[3]; }; class classvector { public: float v[3]; classvector(){} }; int main() 1 0.0 0.9 { 1 0.0 0.2 for(unsigned int count = 0; count < 20000; ++count) { classvector v; 20,000 46.6 3,045.5 v.v[0]=1; structvector k; 20,000 47.9 3,124.8 k.v[0]=1; } 1 0.0 0.4 }
The numbers in the order that they appear are Count, % of program spent in children, execution time spent in children. As you can see, the constructors didnt register in the code, the % of execution time spent accessing the array in the class and struct was roughly the same, with the class version slightly faster.
[edited by - Jingo on May 26, 2004 11:46:29 AM]