From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27569 invoked by alias); 27 Nov 2007 17:44:39 -0000 Received: (qmail 27560 invoked by uid 22791); 27 Nov 2007 17:44:38 -0000 X-Spam-Check-By: sourceware.org Received: from mail5.primus.ca (HELO mail-09.primus.ca) (216.254.141.172) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 27 Nov 2007 17:44:32 +0000 Received: from ottawa-hs-209-217-122-41.s-ip.magma.ca ([209.217.122.41] helo=[192.168.8.125]) by mail-09.primus.ca with esmtpa (Exim 4.63) (envelope-from ) id 1Ix4U2-0007Ao-1U; Tue, 27 Nov 2007 12:44:30 -0500 Message-ID: <474C57A7.5000505@ellipticsemi.com> Date: Tue, 27 Nov 2007 17:46:00 -0000 From: Tom St Denis User-Agent: Thunderbird 2.0.0.6 (X11/20071022) MIME-Version: 1.0 To: "J.C. Pizarro" CC: gcc-help@gcc.gnu.org Subject: Re: reduce compilation times? References: <998d0e4a0711270748x224a16d5ye84fc0eae5ac90d5@mail.gmail.com> <5abcb5650711270804o171e1facr565beec70314af75@mail.gmail.com> <998d0e4a0711270827j6c8f3a41h4d02c62c604a27cf@mail.gmail.com> <474C4940.4010809@ellipticsemi.com> <998d0e4a0711270913s5c47daa9gce35a6681b5cec76@mail.gmail.com> In-Reply-To: <998d0e4a0711270913s5c47daa9gce35a6681b5cec76@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Authenticated: elp125 - ottawa-hs-209-217-122-41.s-ip.magma.ca ([192.168.8.125]) [209.217.122.41] X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2007-11/txt/msg00311.txt.bz2 J.C. Pizarro wrote: > On 2007/11/27, Tom St Denis wrote: > >> This is why you should re-factor your code as to contain only one [or as >> few as possible] exportable functions per unit. >> >> If you write an entire 100K line program as "main.c" of course you'll be >> hit by slow compiles. >> >> But if you factor the code you can get good savings. For instance, one >> of my OSS projects (if you know who I am you know what I'm talking >> about) is ~50K lines and compiles in ~29 seconds on a pentium 4. It >> builds in 8 seconds a quad-core Intel Core2. For most files [units] I >> only have one function, so the line count per file is on average ~200 or so. >> > > It's good idea, "to refactorize the code" and "to split many functions > to many files" > (e.g. one file per one function) with the objective of re-compile-time reduction > (many compiled objects don't need to be recompiled). > > GCC needs LTO (Link Time Optimization), too. > It also carries the benefit of making working with others easier as you're putting locks on smaller portions of the overall project. As for link time optimizations, the only downside really is inlining, and you can always use #define macros for that. Tom