From owner-freebsd-questions@FreeBSD.ORG Tue Jun 19 15:14:47 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1D910106566B for ; Tue, 19 Jun 2012 15:14:47 +0000 (UTC) (envelope-from fred.morcos@gmail.com) Received: from mail-gg0-f182.google.com (mail-gg0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id CB6CF8FC0C for ; Tue, 19 Jun 2012 15:14:46 +0000 (UTC) Received: by ggnm2 with SMTP id m2so5500206ggn.13 for ; Tue, 19 Jun 2012 08:14:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=I9Yx//KNveV1Wtn0vqf/Dj/TxLGd9KWznV+X2itrBMo=; b=h9aKgO4wxShOD/eqvh1XZmvTOVePV+Si6NcyZ7Hsn339RsG5gSiThLtYA5nTNrHtN9 XvRf4AVvVZr4RCW0+IP9m6MAW4lJBhg5R0z/h7+CU9kvOQDrIEpeRSNfZAYQDTrAIKAC 0P9llRyXq8AwEqzP62bD7Zl35eIrz76dHc4BFZhIWoAXxae9d0I4pwT5bVTo0c9ZEadx fzoQI5Bc0R5UradtuoZ8EMhliZGJgzKMtyuujA/Y1Bt8uIEO53GCtblrC0CMrEdFIRCP E1WXz0K/6q4E1cuY3VjJfAwwH36vWhUypA4GCJxt83cN4O8Ku4jafDdLxmQwINopBCZA Yjvg== Received: by 10.60.29.169 with SMTP id l9mr20259748oeh.14.1340118886255; Tue, 19 Jun 2012 08:14:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.241.7 with HTTP; Tue, 19 Jun 2012 08:14:25 -0700 (PDT) In-Reply-To: <402199FE-380B-41B6-866B-7D5D66C457D5@lpthe.jussieu.fr> References: <402199FE-380B-41B6-866B-7D5D66C457D5@lpthe.jussieu.fr> From: Fred Morcos Date: Tue, 19 Jun 2012 17:14:25 +0200 Message-ID: To: Michel Talon Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Cc: Wojciech Puchar , David Brodbeck , FreeBSD Questions Subject: Re: Why Clang 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, 19 Jun 2012 15:14:47 -0000 I would also guess that the base system is stuck with gcc ~4.1 due to the GPLv3-ization of later gcc version. Is that correct? On Tue, Jun 19, 2012 at 4:43 PM, Michel Talon wrot= e: > David Brodbeck said: >> Another way of looking at it is after 25 years of optimization GCC is >> unable to beat a new compiler that's had almost none... > Unfortunately this affirmation is blatantly false, recent gcc produce cod= e > much faster than clang. I give here an example which i like, a monte carl= o computation for a spin lattice. > Everything runs on my macbook. > > lilas% clang -v > Apple clang version 2.1 (tags/Apple/clang-163.7.1) (based on LLVM 3.0svn) > Target: x86_64-apple-darwin11.4.0 > lilas% clang -O4 test.c -lf2c > lilas% time ./a.out > ... > > real =A0 =A00m2.359s > user =A0 =A00m2.341s > sys =A0 =A0 0m0.003s > > lilas% /usr/local/bin/gcc -v > =85 > gcc version 4.6.1 (GCC) > > lilas% /usr/local/bin/gcc -O3 test.c -lf2c > lilas% time ./a.out > =85 > > real =A0 =A00m1.241s > user =A0 =A00m1.234s > sys =A0 =A0 0m0.003s > > So gcc gives an executable running twice faster than clang, basically, wh= en both compilers > are run at maximal optimization. To show the effectiveness of the optimiz= er, here is the running > time without any optimization: > > lilas% /usr/local/bin/gcc =A0test.c -lf2c > lilas% time ./a.out > =85 > > real =A0 =A00m6.895s > user =A0 =A00m6.889s > sys =A0 =A0 0m0.005s > > What this demonstrates is that for programs which do real computations, o= ptimization is > *very* important, and gcc is now very good (i have not shown the numbers = but they match the Intel compiler) > while clang is at the level gcc was ten years ago. So i fully agree with = Wojciech Puchar, the move to clang > is only driven by anti GPL propaganda which is frankly completely stupid,= since in any events, gcc > does not contaminate the binaries it produces (except when using contamin= ated accompanying libraries > e.g. for C++). Of course, when compiling FreeBSD kernel or similar progra= ms which do little computation > there is no harm using clang. I suspect that the price is higher for prog= rams like mencoder which require > the highest efficiency. > > I will not comment on the better error messages coming from clang, this c= ould be a more serious argument. > > -- > > Michel Talon > talon@lpthe.jussieu.fr > > > > >