Filling an array without pre-allocation does not stress the processor, but the memory. Therefore the processor is most of the time in sleep mode during your program runs. Matlab's collaboration with the memory manager of Window 7 is obviously better than with the manager of Ubuntu.
Matlab 2012a uses a new technique to reduce the drawbacks of a missing pre-allocation. It seems, like it allocates memory in larger chunks predictively, buit I do not know any details.
Therefore your measurements are not surprising. If you need a more detailed answer, post the exact description of the used operating systems and Matlab versions (version numbers and 32/64 bits). In addition post the amount of installed and available RAM as well as the type and speed of the RAM.
Best Answer