This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
Re: random variate from power exponential distribution: performances
- From: Linas Vepstas <linas at austin dot ibm dot com>
- To: Giulio Bottazzi <giulio dot bottazzi at libero dot it>
- Cc: gsl-discuss at sources dot redhat dot com
- Date: Mon, 27 Sep 2004 11:00:08 -0500
- Subject: Re: random variate from power exponential distribution: performances
- References: <20040926144946.2e6fd425.giulio.bottazzi@libero.it>
Hi,
On Sun, Sep 26, 2004 at 02:49:46PM +0200, Giulio Bottazzi was heard to remark:
> I attach my little program. I compiled it with NO OPTIMIZATION using
>
> gcc -lgsl -lgslcblas testran.c -o testran
You should test again with optimization turned on. This can make
a *huge* difference in relative performance. Without optimization,
the compiler does literally what the C code says, with an excess use of
register-to-register copies. Thus, and sort of redundant statements
such as x=y; in your code, which should have been a no-op, will
result in register-to-register copies, even if there is no point
in doing those. Optimization removes this kind of un-intended
side-effects from your programs; these unitended side-effects can
swamp the true performance.
Note also that due to instruction set differences, you will often get
different results for Intel and (for example) PowerPC. What's faster
on one may well be slower on the other.
--linas