[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How much time to count from 1 to 1e7?
From: |
John W. Eaton |
Subject: |
How much time to count from 1 to 1e7? |
Date: |
Thu, 9 Aug 2001 12:04:18 -0500 |
On 8-Aug-2001, Denis Pelletier <address@hidden> wrote:
| I started playing with Octave in the last few weeks. I'm presently running
| Octave 2.1.34 on an AMD K7 1.2 GHz. I do most of my work with Gauss.
|
| I'm trying to have a feel of how fast Octave is. I made simple programs in
| Octave and Gauss to compare both. In many cases, Octave is faster (e.g.
| computing the inverse of a matrix). But the "while" command of Octave
| seems pretty slow compare to the one in Gauss. With Octave the following
| program takes 146 seconds:
| i=1;
| tic;
| while (i <= 1e7)
| ++i;
| endwhile
| toc
|
| The equivalent program in Gauss takes 12 seconds.
|
| Am I doing something wrong? Is there a way to speed up Octave? An
| optimization flag when compiling Octave?
Some observations:
* The tic/toc functions measure wall-clock time, so they are not
reliable measures of CPU time. We have no idea what other things
were happening on your machine when you did the test, and that
could cause a lot of variation in the results. If you want to
measure CPU time more reliably, use the cputime function.
* As already noted, Octave was not built with scalar operations in
mind.
* Some things that are particularly slow in Octave are loops and
function calls.
* Yes, other scripting languages can do these things better, so it
should be possible to make Octave faster. It may require some
pretty radical changes to the sources, however, so I wouldn't
necessarily expect a compiler switch to do the trick (sorry if
that's not the answer you were looking for).
* There are limited resources for Octave development. If you want
things to improve, then provide code, funds, or time (or some
combination).
jwe
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
RE: How much time to count from 1 to 1e7?, Michael Underwood, 2001/08/09
Re: How much time to count from 1 to 1e7?, Etienne Grossmann, 2001/08/09