Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 4 became extremely slow and kills my hard drive

My machine has 8 GB or RAM, Core 2 Duo 3,06 GHZ and it seems it is not enough for Xcode 4 (4.0.1). From some time now it started to behave more and more slow. Auto completion, editing code as well as Xib files became almost impossible to use.

Other applications behave smoothly.

Activity monitor shows a lot of RAM usage (still few GB left of completely free memory, so it is quite OK) and huge disk activity usage. I can see on the graph high peaks of data being saved periodically when I work in Xcode. After 3 hours of work there is 10.5 GB of data written to the disk. Is it normal?

I have tried to disable auto-save but it did not help much.

What can be the other causes of this extremely slow behavior of Xcode 4?

It did not behave like this from the beginning and it is not during Xcode indexing. To be even more interesting: when Xcode is indexing my project after cleaning it takes less CPU power than when indexing is done (CPU raises up after indexing again). Heh?

UPDATE: Complete reinstall of Snow Leopard (to the cleaned disk) together with Xcode did not help much. Xcode was working quite well just for a day or so and then slowed down again to the degree it is hardly possible to work with.

like image 946
Lukasz Avatar asked Jun 03 '11 10:06

Lukasz


1 Answers

UPDATE:

The solution was to mock around with #import "header.h" statements. It looks like Xcode requires a lot of processing power for intellisense when you you have complicated / circular imports structure (tracked down by performance tools - Xcode was falling into infinite recursive function call loop). When I moved as many imports I could to the implementation files and used forward declarations in headers, the problem went away.

This is what I have tried before:

  1. Reinstalling (complete removal by: sudo /Developer/Library/uninstall-devtools –mode=al) and installed new version 4.0.2 - Did NOT help at all. Anyway - Is it really complete removal as my main custom Xcode preference settings has survived)?
  2. Defragmentation (iDefrag - full defragmentation with rebuiling B-Tree and Metadata) - Did NOT help at all.
  3. System cleaning and antivirus scanning - CleanMyMac, MacKeeper - did NOT help at all.
  4. Organizer - Repositories - cleaned all repositories (I use Git and Xcode somehow stores list there for its own reasons even if I use only command line to manage Git) - small improvement.
  5. Organizer - Projects - cleaned all Projects from the list except opened ones - small improvement
  6. File - Source control - disable Show Remote Status (was enabled somehow, thx to ThomasW for pointing to that), but did NOT help much.
  7. Xcode - Preference - General - Disable Auto-Save (prompt only) and both Live Issues (In Editors, In Issue Navigator) - quite a bit of improvement.
  8. Closed Utility Panel and Quick Help Pane - the biggest improvement! . I can finally type smoothly again! What a surprise. Such a trivial solution. It looks like help indexing / search assistant simply sucks! Why it does not do lookups in the background or something?

Xcode is still slow but now it is almost possible to work with production quality performance. Anyway it is quite a shame that Core 2 Duo 3,06Ghz / 8BG DDRIII Ram / Momentus XT SS Hybrid can hardly make it. I was so close to buy OCZ Vertex SSD or some other super extra SSD because of this.

like image 183
Lukasz Avatar answered Sep 21 '22 12:09

Lukasz