Re: -O2 vs. -O3
Daniel Cassidy <[email protected]>
| Newsgroups | gmane.comp.kde.cafe |
|---|---|
| Message-ID | <[email protected]> |
On Tuesday 22 April 2003 9:07 am, James Richard Tyrer wrote: > I had this odd thought last week: does -O3 optimization really > make an executable run faster on a system with a L3 cache? > > IIUC, -O3 optimization unrolls loops, but caching is based on the > theory that the same code will be run more than once. How large is L3 cache? I would imagine that unrolling loops would provide a speed improvement where the number of instructions performed per iteration is too large to fit in the cache, but slow things down where it isn't. Whether the former is a realistic scenario of course depends on whether L3 cache is a few bytes or a couple of K. GCC seems to be quite good at knowing the quirks of different processors - I'd be surprised if specific optimisations such as unrolling loops remain enabled even in cases where they'd prove detrimental to performance. It's just a shame that GCC's interpretation of what constitutes valid C code changes seemingly at random with each release. -- dan "Were i susceptible to having my mind changed, it would have changed my mind" - Matthew Parris Kde-cafe mailing list - [email protected] http://ofb.biz/lists/listinfo.cgi/kde-cafe DISCLAIMER: The views expressed on this mailinglist are the personal opinions of the author and do not represent OfB.biz: Open for Business, KDE or the author's employer.