[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: cellfunc vs cell2mat speed?
From: |
Levente Torok |
Subject: |
Re: cellfunc vs cell2mat speed? |
Date: |
Tue, 9 Sep 2008 21:43:56 +0200 |
User-agent: |
KMail/1.9.6 (enterprise 0.20070907.709405) |
Hi David and others
This is small speed test:
function t = test( s )
t = time;
c=cell( s, 1 );
r = rand( 8, 1 );
c{:,1} = r;
cc = cell2mat( c );
t = time - t;
end
octave:4> test( 1000 )
ans = 0.27966
octave:5> test( 10000 )
ans = 12.347
octave:6> test( 13000 )
ans = 26.865
octave:3> test( 16000 )
ans = 47.761
octave:4> test( 19000 )
ans = 83.082
As it seems, each adding of 3000 elements doubles the time it needs to convert
cell to matrix.
I believe the slowness is due to the recursive scripting nature of the
cell2mat.m function.
I thought I will write a small conversion program in C with limited
capabilities for my own needs
( ie. only c{i,1} =matrix will be handled ) but I am so much confused with the
interface of the
Cell class.
( NB: if I replace cell2mat with cellfun( c, "mean" ) I would get:
octave:10> test( 20000 )
ans = 8.0793
and this increases linearly with size of the cell array)
Thank you very much in advance,
Levente
--
Blogger of http://fapuma.blogspot.com
- cellfunc vs cell2mat speed?, Levente Torok, 2008/09/09
- Re: cellfunc vs cell2mat speed?, David Bateman, 2008/09/09
- Re: cellfunc vs cell2mat speed?,
Levente Torok <=
- Re: cellfunc vs cell2mat speed?, David Bateman, 2008/09/09
- Re: cellfunc vs cell2mat speed?, Levente Torok, 2008/09/09
- Re: cellfunc vs cell2mat speed?, David Bateman, 2008/09/09
- [Changeset} Re: cellfunc vs cell2mat speed?, David Bateman, 2008/09/09
- [Changeset} Re: cellfunc vs cell2mat speed?, John W. Eaton, 2008/09/11
- Re: [Changeset} Re: cellfunc vs cell2mat speed?, David Bateman, 2008/09/15
- Re: [Changeset} Re: cellfunc vs cell2mat speed?, John W. Eaton, 2008/09/17
- Re: [Changeset} Re: cellfunc vs cell2mat speed?, dbateman, 2008/09/17
- Re: [Changeset} Re: cellfunc vs cell2mat speed?, John W. Eaton, 2008/09/17