[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: includes/imports in gui.

From: David Chisnall
Subject: Re: includes/imports in gui.
Date: Thu, 18 Feb 2010 10:44:49 +0000

On 18 Feb 2010, at 10:34, Nicola Pero wrote:

>> It's also worth noting that our Cocoa.h is a LOT smaller than Apple's.  The 
>> output from gcc -E on a simple .m file that just contains the line #import 
>> <Cocoa/Cocoa.h> is around 800KB on GNUstep and over 3MB with Cocoa.
> How interesting. :-)
> That suggests processing the headers in Cocoa would take almost 4x what it 
> takes on GNUstep (all other things being equal),
> and so a precompiled header would indeed have a much larger effect on an 
> Apple build.
> That would explain why Apple developers are so keen on it.  I couldn't really 
> figure out why they are so keen on precompiled headers
> because when I tried them on GNUstep it was so hard to get any big 
> performance speedups out of them. ;-)

It's also worth noting that Apple's GCC is a LOT slower than the FSF GCC.  I 
ran some simple tests and found that FSF GCC 4.2.1 in a FreeBSD VM was around 
2-4 times faster for Objective-C than Apple GCC 4.2.1 in the OS X system 
hosting the VM.  Even with the extra overhead of the VM, the FSF version was 
still a lot faster.  I suspect that the cost of reading the individual files is 
a lot higher on OS X (since it has to go via the Mach layer, where data tends 
to get tired and have a little rest before returning).

If the first file that you compile imports Cocoa.h, then you actually get some 
of the benefits from PCH even if you're not using them; all of the referenced 
files will be in the disk cache, so the next time you try to access them you 
won't have to hit the disk.  


-- Sent from my IBM 1620

reply via email to

[Prev in Thread] Current Thread [Next in Thread]