help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cellfun vs. parcellfun: speed


From: Francesco Potortì
Subject: Re: cellfun vs. parcellfun: speed
Date: Tue, 04 Sep 2012 13:34:08 +0200

>I had always thought of parcellfun as being a faster version of
>cellfun.

That depends on the function you call.

>Until today, where I encountered a stunning example of cellfun being MUCH
>faster than parcellfun. In decreasing order:
>
>octave> tic ; parcellfun (4, @isempty, cell(1,100000)) ; disp(toc);
>parcellfun: 100000/100000 jobs done
> 12.17
>octave> tic ; parcellfun (4, @isempty, cell(1,100000), "VerboseLevel", 0) ;
>disp(toc);
> 7.3
>octave> tic ; cellfun (@isempty, cell(1,100000)) ; disp(toc);
> 0.065
>
>So why should one use parcellfun? - Or is something not working as expected?

As for any shift from sequential to parallel operation, you should do
that only if the overhead of managing the parallel operations is
negligible with respect to the time needed to execute the operation, or
at least smaller enough.

You chose the opposite extreme case: the time needed to execute the
operation is almost null (and moreover I think cellfun is optimised for
that case).

Once you resort to a real case, with an operation that needs some time
to be executed, you may still need to use the ChunksPerProc option to
obtain a benefit: read parcellfun help carefully to learn how to use it.

-- 
Francesco Potortì (ricercatore)        Voice:  +39.050.315.3058 (op.2111)
ISTI - Area della ricerca CNR          Mobile: +39.348.8283.107
via G. Moruzzi 1, I-56124 Pisa         Fax:    +39.050.315.2040  
(entrance 20, 1st floor, room C71)     Web:    http://fly.isti.cnr.it


reply via email to

[Prev in Thread] Current Thread [Next in Thread]