This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: random variate from power exponential distribution: performances


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]