From: Brendan Hannigan on
"Royi Avital" <RoyiREMOVEAvital(a)yahoo.com> wrote in message <ht87at$u9$1(a)fred.mathworks.com>...
> Parker <xenoszh(a)gmail.com> wrote in message <d7dbddd0-5571-4ec4-8183-e5f76a31edb8(a)f14g2000vbn.googlegroups.com>...
> > On May 21, 9:57 pm, Parker <xeno...(a)gmail.com> wrote:
> > > The old version of block processing in Matlab is invoked by "blkproc",
> > > while the new version which I used now (R2009b) introduces a new
> > > method as "blockproc". The difference according to the official
> > > website I can see is the new function consider each block as a struct,
> > > rather than matrix in the old version.
> > >
> > > As I assumed, the newer one should more effective and faster than the
> > > old one. However, it's not true. Why does this happen? The test code
> > > is as following, the old function is about 10 times faster than the
> > > newer one???:
> > >
> > > >> a = rgb2gray(imread('test.jpg'));
> > > >> y1 = @(x) mean2(x)*ones(size(x));
> > > >> y2 = @(x) mean2(x.data)*ones(size(x.data));
> > > >> tic;e = blkproc(a,[2 2],y1);toc;tic;f = blockproc(a,[2 2],y2);toc;
> > >
> > > Warning: BLKPROC will be removed in a future release. Use BLOCKPROC
> > > instead.> In blkproc at 68
> > >
> > > Elapsed time is 0.431351 seconds.
> > > Elapsed time is 4.582460 seconds.
> >
> > no comments?
>
> Why do you assume the new version is faster?
> Does Matlab handles structures faster than Matrices? I'm not sure.
>
> Though the performance gap you found is beyond reasonable.

The poor performance of BLOCKPROC in R2009b & R2010a for in-memory syntaxes is a known issue. In the latest release, R2010a, the BLKPROC warning has been removed (the warning suggesting to use BLOCKPROC instead).

BLOCKPROC provides additional functionality beyond BLKPROC, such as file-to-file block processing for arbitrarily large TIFF images. Unfortunately, for these in-memory syntaxes that BLKPROC supports, the performance of BLOCKPROC is not comparable to that of BLKPROC in the R2009b & R2010a releases.

Improving the in-memory syntax performance of BLOCKPROC such that it is comparable to BLKPROC is a very high priority.