From: Darren Rowland on
4 equal halves? That doesn't sound feasible at all.

Try posting the code so someone can test it for themselves.
From: Vikas Bajpai on
On Apr 21, 3:13 pm, "Darren Rowland"
<darrenjremovethisrowl...(a)hotmail.com> wrote:
> 4 equal halves? That doesn't sound feasible at all.
>
> Try posting the code so someone can test it for themselves.

Sir
let me try to explain the problem in some simpler way. Suppose I
have an image and i am performing an operation using for loop on the
image as a whole and the time comes out to be 2.55 seconds. Now I am
using 4 for loops and implementing these for loops on four equal parts
of the image and time comes out to be 0.11 second. Although this
sounds unusual but I have this result but I don't know why this is
happening.
From: vortse a on
Vikas Bajpai <vikas.bajpai87(a)gmail.com> wrote in message <9367d998-e25a-4ccb-9cf3-fa5394502fd3(a)u9g2000prm.googlegroups.com>...
>
> Sir
> let me try to explain the problem in some simpler way. Suppose I
> have an image and i am performing an operation using for loop on the
> image as a whole and the time comes out to be 2.55 seconds. Now I am
> using 4 for loops and implementing these for loops on four equal parts
> of the image and time comes out to be 0.11 second. Although this
> sounds unusual but I have this result but I don't know why this is
> happening.

Do you preallocate your matrices? If not, then your "speedup" might be caused by having your matrices already allocated after the first loop. You should always preallocate.

Another possible reason is that perhaps your full image is so big that you're reaching the limit of RAM available to Matlab, in which case things tend to slow down, specially if you are using the OS's virtual memory, which means accessing the hard disc a lot. If ithat is the case, then you should be modify you code to perform inplace computations where possible and clear unneeded matrices.

You should really post your code, or at least the relevant part of it.
From: Walter Roberson on
Vikas Bajpai wrote:

> let me try to explain the problem in some simpler way. Suppose I
> have an image and i am performing an operation using for loop on the
> image as a whole and the time comes out to be 2.55 seconds. Now I am
> using 4 for loops and implementing these for loops on four equal parts
> of the image and time comes out to be 0.11 second. Although this
> sounds unusual but I have this result but I don't know why this is
> happening.

In addition to the other responses (e.g., talking about preallocation):

You have not told us anything about what kind of processing you are
doing. There are some kinds of processing that take much more time as
they are applied to bigger problems. For example, anything involving
covariances or inverses or matrix division takes time that increases
with the square or cube or 4th power of the size of the matrix.
From: Vikas Bajpai on
On Apr 21, 8:09 pm, Walter Roberson <rober...(a)hushmail.com> wrote:
> Vikas Bajpai wrote:
> >   let me try to explain the problem in some simpler way. Suppose I
> > have an image and i am performing an operation using for loop on the
> > image as a whole and the time comes out to be 2.55 seconds. Now I am
> > using 4 for loops and implementing these for loops on four equal parts
> > of the image and time comes out to be 0.11 second. Although this
> > sounds unusual but I have this result but I don't know why this is
> > happening.
>
> In addition to the other responses (e.g., talking about preallocation):
>
> You have not told us anything about what kind of processing you are
> doing. There are some kinds of processing that take much more time as
> they are applied to bigger problems. For example, anything involving
> covariances or inverses or matrix division takes time that increases
> with the square or cube or 4th power of the size of the matrix.

sir I am only performing plus and minus operations, not more than that