I will be away from my computer for a week, but what I could try today shows that Matlab JIT is doing some tricks so the results I have shown previously for Matlab are likely to be wrong. In this sense, it seems to be that timings are similar between numpy and matlab if Jit tricks are avoided.
Next week I will run more tests. I am planning to summarize the results and put them somewhere on the web, since in some cases numpy +numexpr greatly outperform matlab- however I will first make sure that JIT is not shadowing the conclusions El 20/07/2011, a las 11:04, Pauli Virtanen <p...@iki.fi> escribió: > 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 _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion