[Numpy-discussion] Matlab vs. Python (Was: Re: [SciPy-Dev] Good-bye, sort of (John Hunter))

Sturla Molden sturla@molden...
Sun Aug 15 15:10:13 CDT 2010

> It's not fully pass-by-value, a copy is only made if the matrix/array
> is changed, but not if only accessed for getting the data. And from
> the comments I have seen they keep improving lazy copying.

Yes it is copy-on-write. But that means we must restrict ourselves to
read-only access.

It also means that we cannot memory map a file. If there is a write
operation, we get a copy of the whole file into RAM.

Matlab also takes a copy if we create an array slice. It means for example
that a wavelet transform written in Python will be O(n) with respect to
memory, whereas it will be O(n log n) in Matlab.

I am working on data that are recorded at 48 kHz, 16-32 channels, for
several minutes. Memory issues like these do matter.

>> 4. Matlab is single-treaded. Python allows threads, although there is a
>> GIL (which can be freed when running C or Fortran library code). Matlab
>> use MKL for multi-cores, NumPy/SciPy can be compiled against MKL or
>> ACML.
>> Threads are not just for parallel processing, but also for I/O and GUI
>> interaction.
> since 2007a:
> "MATLAB has multithreaded computation support for many linear algebra
> and element-wise numeric operations, allowing performance improvement
> on multicore and multiprocessor systems."

That is due to MKL and FFTW. I have NumPy and SciPy linked with MKL. It
uses all four cores on my laptop for linear algebra as well.

Matlab does not have a multi-threaded interpreter. Please don't confuse this.


More information about the NumPy-Discussion mailing list