Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Sep 2006 15:32:29 +0200 (CEST)
From:      Oliver Fromme <olli@lurza.secnetix.de>
To:        freebsd-stable@FreeBSD.ORG, kline@sage.thought.org
Subject:   Re: optimization levels for 6-STABLE build{kernel,world}
Message-ID:  <200609141332.k8EDWTKa048254@lurza.secnetix.de>
In-Reply-To: <20060913234934.GA92067@thought.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Gary Kline wrote:
 > A couple of things.  Will having gcc unroll loops have any
 > negative consequences?

Yes.  It will make the code slower, in most cases.
In modern processors, the loop overhead is almost zero.
That's because the "branch prediction unit" of a processor
also predicts loop instructions (which are just a special
case of conditional branches), and chances are that the
whole loop body is in the L1 cache.  If it is too large
to fit into the L1 cache, then the loop overhead doesn't
matter anyhow.

There are very, very few special cases where unrolling a
small loop might give a little speed improvement.  Bit in
most cases, it makes things worse.

Also, don't expect miracles from -O3.  It certainly won't
make your kernel run twice as fast, and I even doubt that
there would be any measurable difference.  Therefore I'm
not concerned at all that -O3 isn't officially supported.

Best regards
   Oliver

-- 
Oliver Fromme,  secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing
Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

"C++ is to C as Lung Cancer is to Lung."
        -- Thomas Funke



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200609141332.k8EDWTKa048254>