MATLAB: Does matlab 2012a auto vactorize

forvectorization

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.

Best Answer

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.