Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Vectorized Code: *Why* it works..?
Replies: 3   Last Post: Apr 27, 2013 2:52 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Nasser Abbasi

Posts: 6,253
Registered: 2/7/05
Re: Vectorized Code: *Why* it works..?
Posted: Apr 26, 2013 9:10 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 4/26/2013 7:04 PM, Loki wrote:
> Vecorized code is tremedously faster when compared to non-vectorized
> code.
> Why is so? Reason lies only in CPU vector instructions that matlab
> uses internally when execute vetorized code, or there are other
> reasons?
> To find more informations via google is strangely difficult.

In here


It just says

"Vectorize your code to take advantage of the full functionality of MATLAB."

But if you follow the link to


"Performance: Vectorized code often runs much faster than the corresponding code containing loops."

as to WHY vectorized code is faster, well, I think only person who can answer this
for sure, is someone working inside Matlab, in the run-time/compiler group.

But simply googling "matlab why is vectorized faster" I see many well reasoned
answers there all over the web on this. I only see sites showing that
vectorized code is not always faster the loops. I seem to remember that
few years ago MW did improvement to their jit compiler to improve loop
speeds, so the difference is not that much. I would guess it depend on
the code being processed each time.


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2015. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.