Does matlab 2012a auto vactorize?

1 回表示 (過去 30 日間)
David Bergman
David Bergman 2012 年 7 月 28 日
I recently had 2012a installed at work. I had previously had 2010. I noticed a surprising performance improvement in code that contained for loops, that had not been vectorized. Several people at work noticed this causing us to speculate that matlab contained an internal vectorized version of "for".
Can anyone shed light on this? Thanks.

採用された回答

Walter Roberson
Walter Roberson 2012 年 7 月 28 日
Yes, between those two releases, MATLAB did make a significant optimization improvements. One of the significant improvements was that MATLAB now automatically predicts preallocation requirements, saving significant time in memory management if the programmer had not put in preallocation.

その他の回答 (1 件)

David Bergman
David Bergman 2012 年 7 月 28 日
Walter, thanks. Do you know of any documentation on this? It makes me wonder if it's even worth learning to vectorize ;-). Once you get good at it, it makes you thinks differently about how to structure and write code. Many young engineers are educated on matlab and never learn C/C++ or FORTRAN. If one writes C-style code in matlab can you expect it to run just as fast as C? Thanks again.
  1 件のコメント
Star Strider
Star Strider 2012 年 7 月 28 日
For documentation, I refer you to ‘Release Notes’: http://www.mathworks.com/help/techdoc/rn/rn_intro.html.
For the rest I refer you to Walter Roberson.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by