Performance of alloca

  alloca, c++, performance, stack

I’m using alloca a lot these days, to allocate temporary buffers. In my application (signal processing) this is a common need. The question is – when allocating multiple arrays, is it better (performance-wise) to use alloca just once like this:

float *array1 = (float*)alloca(4096 * 4);
float *array2 = array1 + 1024;
float *array3 = array2 + 1024;
float *array4 = array3 + 1024;

or use it multiple times:

void *array1 = (float*)alloca(4096);
void *array2 = (float*)alloca(4096);
void *array3 = (float*)alloca(4096);
void *array4 = (float*)alloca(4096);

I mean all it probably does is decrease the stack pointer and probably do the "stack probe", which depends on the size, so it perhaps doesn’t matter?

Source: Windows Questions C++