On 1/7/2009 4:16 PM, David Cournapeau wrote:

> I think on recent versions of matlab, there is nothing you can do
> without modifying the code: matlab has some JIT compilation for loops,
> which is supposed to speed up those cases - at least, that's what is
> claimed by matlab. 

Yes it does. After using both for more than 10 years, my impression is this:

- Matlab slicing creates new arrays. NumPy slicing creates views. NumPy 
is faster and more memory efficient.

- Matlab JIT compiles loops. NumPy does not. Matlab is faster for stupid 
programmers that don't know how use slices. But neither Matlab nor 
Python/NumPy is meant to be used like Java.

- Python has psyco. It is about as good as Matlab's JIT. But psyco has 
no knowledge of NumPy ndarrays.

- Using Cython is easier than writing Matlab MEX files.

- Python has better support for data structures, better built-in 
structures (tuple, lists, dics, sets), and general purpose libraries. 
Matlab has extensive numerical toolboxes that you can buy.

- Matlab pass function arguments by value (albeit COW optimized). Python 
pass references. This makes NumPy more efficient if you need to pass 
large arrays or array slices.

- Matlab tends to fragment the heap (hence the pack command). 
Python/NumPy does not. This makes long-running processes notoriously 
unstable on Matlab.

- Matlab has some numerical libraries that are better.

- I like the Matlab command prompt and IDE better. But its not enough to 
make me want to use it.

- Python is a proper programming language. Matlab is a numerical 
scripting language - good for small scripts but not complex software 
systems.


Sturla Molden







_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to