[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: compare the executive speed with Matlab
From: 
John W. Eaton 
Subject: 
Re: compare the executive speed with Matlab 
Date: 
Fri, 2 Jan 2009 16:03:15 0500 
On 2Jan2009, Sergei Steshenko wrote:
 Sure, sure.

 1) 'octave':

 octave:36> angles = pi * (1:1000000) / 1000000;tic; sins = sin(angles); toc
 Elapsed time is 0.49532795 seconds.
Please, use cputime. Wall clock time is meaningless here as there
could be other things running on your system which affect the timing.
 2) "C":

 CPU time took 0.13 seconds at line number 74 of 'benchmark_sin.c' file
 Wallclock time took 0.130743 seconds at line #74 of 'benchmark_sin.c' file


 ; the file is attached ('benchmark_sin.c'), it contains the command line
 I used to compile it.

 OK, so it's not 5 times, it's more than 3 times.

 I think, however, that if I use table representation of 'sin', the ratio
 will be the 5 times I vaguely remember.
So, how did you build Octave, and what version is it?
Here is what I see with Octave 3.0.3 on a Debian AMD64 system. My
copy of Octave is installed from the Debian package and used GCC 4.3.2
(Debian 4.3.21) with O2 (and no other tricky optimization flags):
octave:1> angles = pi * (1:1000000) / 1000000;
octave:2> t = cputime (); sins = sin (angles); cputime ()  t
ans = 0.072004
Here is what I see with your code using the same version of GCC
$ gcc mtune=native march=native O3 sintst.c lm lrt
$ ./a.out
CPU time took 0.05 seconds at line number 74 of 'sintst.c' file
Wallclock time took 0.0685717 seconds at line #74 of 'sintst.c' file
So I don't really see anything to fix here.
jwe
 compare the executive speed with Matlab, Howard, 2009/01/01
 Re: compare the executive speed with Matlab, Michael Goffioul, 2009/01/02
 Re: compare the executive speed with Matlab, Sergei Steshenko, 2009/01/02
 Re: compare the executive speed with Matlab, John W. Eaton, 2009/01/02
 Re: compare the executive speed with Matlab, Sergei Steshenko, 2009/01/02
 Re: compare the executive speed with Matlab, Jordi GutiĆ©rrez Hermoso, 2009/01/02
 Re: compare the executive speed with Matlab, Sergei Steshenko, 2009/01/02
 Re: compare the executive speed with Matlab, John W. Eaton, 2009/01/02
 Re: compare the executive speed with Matlab, Jordi GutiĆ©rrez Hermoso, 2009/01/02
 Re: compare the executive speed with Matlab, Sergei Steshenko, 2009/01/02
 Re: compare the executive speed with Matlab,
John W. Eaton <=
 Re: compare the executive speed with Matlab, Sergei Steshenko, 2009/01/02
 Re: compare the executive speed with Matlab, wim van hoydonck, 2009/01/02
 Re: compare the executive speed with Matlab, John W. Eaton, 2009/01/02
 Re: compare the executive speed with Matlab, Sergei Steshenko, 2009/01/02
 Re: compare the executive speed with Matlab, Sergei Steshenko, 2009/01/02
 Re: compare the executive speed with Matlab, Sergei Steshenko, 2009/01/02
 Re: compare the executive speed with Matlab, Sergei Steshenko, 2009/01/02
 Re: compare the executive speed with Matlab, Sergei Steshenko, 2009/01/02
 Re: compare the executive speed with Matlab, wim van hoydonck, 2009/01/05
 Re: compare the executive speed with Matlab, John W. Eaton, 2009/01/02