• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
ObjC++ Compile Speed
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ObjC++ Compile Speed


  • Subject: ObjC++ Compile Speed
  • From: Ingvar Nedrebo <email@hidden>
  • Date: Mon, 7 Jan 2002 11:41:31 +0000

I have found that the reason ObjC++ compiles so much slower than plain ObjC is because ObjC++ does not take advantage of the precompiled framework headers. Here are some simple tests to demonstrate this, with four source files, two with Cocoa.h and two without:

Files c.m and cpp.mm:
----------------------------------------
#import <stdio.h>
int main (int argc, const char * argv[])
{
printf("hello world\n");
}
----------------------------------------

Files fc.m and fcpp.mm:
----------------------------------------
#import <Cocoa/Cocoa.h>
int main (int argc, const char * argv[])
{
printf("hello world\n");
}
----------------------------------------


These were all compiled with the command "time cc -o t.o <file>" on my iBook with 10.1.2 and Dec DevTools. The timings are averages over several runs:

c.m (ObjC) 0.26s
cpp.mm (ObjC++) 0.20s
fc.m (ObjC w/Cocoa.h) 0.38s
fcpp.mm (ObjC++ w/Cocoa.h) 6.7s

I will report this as a bug to Apple.


Ingvar


  • Follow-Ups:
    • Re: ObjC++ Compile Speed
      • From: Kurt Revis <email@hidden>
  • Prev by Date: not-quite-a-beginner question about databases
  • Next by Date: Small Font Troubles
  • Previous by thread: not-quite-a-beginner question about databases
  • Next by thread: Re: ObjC++ Compile Speed
  • Index(es):
    • Date
    • Thread