Wed, 20 Jul 2011 08:49:21 +0200, Carlos Becker wrote: > Those are very interesting examples. I think that pre-allocation is very > important, and something similar happens in Matlab if no pre-allocation > is done: it takes 3-4x longer than with pre-allocation. The main > difference is that Matlab is able to take into account a pre-allocated > array/matrix, probably avoiding the creation of a temporary and writing > the results directly in the pre-allocated array.
You have not demonstrated that the difference you have comes from pre-allocation. If it would come from pre-allocation, how come I get the same speed as an equivalent C implementation, which *does* pre-allocation, using exactly the same benchmark codes as you have posted? -- Pauli Virtanen _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion