ObjC++ Compile Speed
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