Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

XCode is compiling slowly

I've noticed a noticeable slow-down in the compile speed of XCode recently. Even when I'm building a simple (less than 50 line) Objective-C program, it compiles slowly. Is this just because of Objective-C, or is there something wrong with my system? Compiling a C program seemed to be much faster.

iMac 2.66 GHz standard configuration (April 2008), Mac OS X (10.6.2), iPod Touch 1st Generation OS 3.1.2, D-link DIR-625 router, iLife 09, iWork 09

Posted on Dec 7, 2009 5:48 PM

Reply
8 replies

Dec 8, 2009 3:10 PM in response to etresoft

For a program like this, how long should it take? I don't what the norm is.


// Implement a Calculator class
#import <Foundation/Foundation.h>
@interface Calculator: NSObject
{
double accumulator;
}
// accumulator methods
-(void) setAccumulator: (double) value;
-(void) clear;
-(double) accumulator;
// arithmetic methods
-(void) add: (double) value;
-(void) subtract: (double) value;
-(void) multiply: (double) value;
-(void) divide: (double) value;
@end
@implementation Calculator
-(void) setAccumulator: (double) value
{
accumulator = value;
}
-(void) clear
{
accumulator = 0;
}
-(double) accumulator
{
return accumulator;
}
-(void) add: (double) value
{
accumulator += value;
}
-(void) subtract: (double) value
{
accumulator -= value;
}
-(void) multiply: (double) value
{
accumulator *= value;
}
-(void) divide: (double) value
{
accumulator /= value;
}
@end
int main(void)
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

double value1, value2;
char operator;
Calculator *deskCalc = [[Calculator alloc] init];

NSLog (@"Type in your expression.");
scanf ("%lf %c %lf", &value1, &operator, &value2);

[deskCalc setAccumulator: value1];
if (operator == '+')
[deskCalc add: value2];
else if (operator == '-')
[deskCalc subtract: value2];
else if (operator == '*' || operator == 'x')
[deskCalc multiply: value2];
else if (operator == '/')
[deskCalc divide: value2];

NSLog (@"%.2f", [deskCalc accumulator]);
[deskCalc release];

[pool drain];
return 0;
}

Dec 9, 2009 3:13 AM in response to musicwind95

Two simple things.

1) close any open projects that you are not actively working on.
This will free up memory, and that is usually an issue when I've seen XCode get slower.

2) save everything and quit from Interface Builder (if open) and quit from XCode. Re-open the project you are working on and try your compile again.

These two steps have worked for me when I've noticed XCode taking a long time to do things.

I also keep a terminal window open and running 'top' in the background and if i think things are getting slow, I check the load level in the top window and whenever I see it crawl higher than 4 or 5, I start looking for running apps to quit and free up memory. That seems to resolve the problems 95% or more of the time.

Once in a while, I've seen XCode get stuck and quitting doesn't seem to help.
At that point, a quick reboot has always solved the problems and XCode is back to normal.

I don't think it's XCode being leaky as much as just not enough memory, especially when I have more than one project open, and several windows open at once in XCode. Remember XCode is the GUI and it calls gcc and other programs to compile and link your project code together. Those processes all use memory too, so the more that XCode is using, the less there is for gcc.

Hope this helps you out.

-Carl

XCode is compiling slowly

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.