compare the executive speed with Matlab
Sergei Steshenko
sergstesh at yahoo.com
Fri Jan 2 15:33:55 CST 2009
--- On Fri, 1/2/09, John W. Eaton <jwe at octave.org> wrote:
> From: John W. Eaton <jwe at octave.org>
> Subject: Re: compare the executive speed with Matlab
> To: sergstesh at yahoo.com
> Cc: "Jordi Guti��rrez Hermoso" <jordigh at gmail.com>, help at octave.org, "Howard" <shj1130 at pchome.com.tw>
> Date: Friday, January 2, 2009, 1:03 PM
> On 2-Jan-2009, Sergei Steshenko wrote:
>
> Please, use cputime. Wall clock time is meaningless here
> as there
> could be other things running on your system which affect
> the timing.
>
>
> octave:1> angles = pi * (1:1000000) / 1000000;
> octave:2> t = cputime (); sins = sin (angles); cputime
> () - t
> ans = 0.072004
Here are better measurements - forgot to lock CPU frequency originally.
1) octave:
angles = pi * (1:1000000) / 1000000;tic;t = cputime (); sins = sin(angles); fprintf(stdout(), "CPU time: %g\n", cputime () - t);toc
CPU time: 0.140009
Elapsed time is 0.14142704010009765625 seconds.
2) "C":
CPU time took 0.04 seconds at line number 74 of 'benchmark_sin.c' file
Wallclock time took 0.0490916 seconds at line #74 of 'benchmark_sin.c' file
- the same 3+ times.
My 'octave' runs on a 32 bits machine. It uses
-mtune=native -march=native -mfpmath=sse,387 -O2
optimizations.
With this simple 'sin' test -mfpmath=sse,387 changes results:
CPU time took 0.06 seconds at line number 74 of 'benchmark_sin.c' file
Wallclock time took 0.047755 seconds at line #74 of 'benchmark_sin.c' file
- the funny thing is that now CPU time is less than wallclock time which
can't be.
If you count by CPU time, still the speedup is 2+ times for
'octave' version is 3.0.3, it was built using the same gcc-4.3.2 I used
for benchmarking the "C" program.
--Sergei.
More information about the Help-octave
mailing list