I cannot say if that is true – it would a big surprise for me. In particular if you are a little careful in your C++ calling. However, GPU optimized code etc can do a lot today. Perhaps certain underlying routines in Matlab are optimized for multi-cores/GPUs etc.
What I do know is that you have to be careful how you measure your time. In particular clock() is not good to use in small loops (granularity of 10 ms, if I remember correctly). Either call you your routine 1000 times an measure time outside or use a better timer. I think there is one called something like QueryPerformanceCounter()
However, I am not following the recent trends…so my information might be a little stale…
so how is it that the vectorised calcs are so much faster in matlab?
From: Ian Scott [mailto:firstname.lastname@example.org]
Sent: Wed 16/05/2012 14:15
To: Friedmann Y.
Subject: Re: [Vxl-users] vectorise image
On 16/05/2012 13:49, Friedmann Y. wrote:
> So is it right to assume that when using vectors in MATLAB to do the
> same calculations, their 10 times higher efficiency is due to compiler
It is long time since I used matlab proper, but at that time it was a
not a compiled language. Octave, the GPL matlab-clone behaves that way
now. Everything was looked up on demand. Not just indexing, but even
variable name dereferencing. Loop content was evaluated (and possibly
even parsed) afresh every iteration. No compilation - therefore no
opportunity for any optimisation.