From: Parker on
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.
From: Parker on
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?
From: Royi Avital on
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.