From owner-freebsd-questions@FreeBSD.ORG Tue Mar 17 16:15:50 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 576DE106566B for ; Tue, 17 Mar 2009 16:15:50 +0000 (UTC) (envelope-from gfritz@gmail.com) Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.175]) by mx1.freebsd.org (Postfix) with ESMTP id 1F2D48FC16 for ; Tue, 17 Mar 2009 16:15:49 +0000 (UTC) (envelope-from gfritz@gmail.com) Received: by wf-out-1314.google.com with SMTP id 24so55549wfg.7 for ; Tue, 17 Mar 2009 09:15:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:received:date:from:to:cc :subject:message-id:references:mime-version:content-type :content-disposition:in-reply-to:user-agent; bh=zkrjVDzvK8qy0GJv9GEqluv6nBtQx56jFjV5BsJOPUI=; b=TrPOd5OTsYW/5lXzusHMbYWi8k1RrxuctVlzToo9VDCQXBO8UDZ/5cYQEHGBkALNpF GM02/YMhPty89eP+bosFSTTgtU7TWzg+Bje7K/kXHnT4vvwglWILFZ98Mc1tPoNc5h+f +sO26+nu68n99MejpfgkLKz9gPxS4zA0oikQA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=kadU8YRh6Q4ScGLv5ARzZZcOw8i3PwMkKg9dgOcPyHAr71q8h42MtKNt5rj9/WLs/Q J2hytxYNgX19eCE7JTMb0oPhVu4mGxPdgAK5uYZ3gVwYVtzKaG4Ny0VVJ/bFznAXIbTS sBph0A3HyZypdl/f5TyS1VU8Oozn3+QrCDeAw= Received: by 10.114.198.5 with SMTP id v5mr110048waf.131.1237306549397; Tue, 17 Mar 2009 09:15:49 -0700 (PDT) Received: from dev.null (181-175-174-206.cust.wirelessbeehive.com [206.174.175.181]) by mx.google.com with ESMTPS id q18sm3550843pog.9.2009.03.17.09.15.48 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 17 Mar 2009 09:15:48 -0700 (PDT) Received: by dev.null (Postfix, from userid 1002) id 92F8813F8; Tue, 17 Mar 2009 10:15:47 -0600 (MDT) Date: Tue, 17 Mar 2009 10:15:47 -0600 From: Geoff Fritz To: Wojciech Puchar Message-ID: <20090317161547.GB6295@dev.null> References: <20090317140221.GA85698@dev.null> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.19 (2009-01-05) Cc: freebsd general questions Subject: Re: Cooking LLVM in FreeBSD 8 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Mar 2009 16:15:50 -0000 On Tue, Mar 17, 2009 at 03:27:37PM +0100, Wojciech Puchar wrote: > > > > It does look promising, though. I hope it'll eventually surpass gcc in > > actually - it's matter of measurement. for example - gcc generated code is > very fast, but often in expense of code size. Even -Os compiled programs > are quite large. > > Large code=less efficient caching=SLOWER overall performance with mixed > load and lots of task switching which is normal under unix. > > Even if this new compiler generates slightly slower but SMALLER code, it > could produce overall-faster system I'm a big supporter of small, efficient binaries. In fact, I'll often put "-Os" in my /etc/make.conf CFLAGS setting. This only rarely improves raw speed over more agressive optimization flags, however. I use it primarily for programs that are huge to begin with (Firefox, for example) or programs that have many instances running (my shell, my terminal program, etc.) for the sake of conserving memory. I tested clang (ccc), the stock 7.1 gcc (4.2.1), and gcc 4.3.4, using -Os and -O0, -O2, and -O3. For raw speed, gcc43 with -O3 took the lead. In every case, even the stock gcc beat ccc. To be honest, I didn't pay too much attention to the binary size, though I'm pretty sure both gcc variants beat ccc in that benchmark. Like I said before, I wasn't overly scientific in my methodology. I compiled the "zip" port for my tests (very fast compile). I ran the same task in a loop 5 times, and took the mean of the timings from "time". I did pre-load the file into filesystem cache by reading it with "dd" before the calls to zip (which wrote to /dev/null). In every case, ccc was last in performance when compared with the same CFLAGS. However, I didn't have time to see if, for example, "-O3" for ccc resulted in a faster binary than "-O0" for gcc. I wish lang/tcc would run under amd64. Talk about small binaries! Somebody with a compulsion for benchmarking could put this to the test. After seeing Roland's benchmarking zeal in the "best archiver" thread, maybe he should join the fun. ;-) -- Geoff