"Michal Kvasnicka" wrote in message <email@example.com>... > "Michal Kvasnicka" wrote in message <firstname.lastname@example.org>... > > How can I prealocate structure to eliminate allocation overhead during computation? > > > > Example: > > s ... size 1x10 struct > > s.x ... size 1x1 double > > s.y ... size 1x1 double > > s.z ... size 1x1 double > > > > Thanks in advance, Michal > > Well, I use this structure initialization: > s(10).x = ; > s(10).y = ; > s(10),z = ; > > with good performance.
So what's your question? When you grow the variables, do s(10).x, s(10).y and s(10).z remean scalars? If no, then you're not preallocating those variables in way that will speed up your program when it executes. Barry