Xcode 4 became extremely slow and kills my hard drive

早过忘川 提交于 2019-12-18 10:49:16

问题


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.


回答1:


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.




回答2:


I was running into performance problems with Xcode 4 and I tracked it down to the File->Source Control->Show Remote Status feature being on. Turning that feature off did the trick for me.

However, if that is not the issue then you should take samples of Xcode while it is having the performance issues. Either use the command line or the Activity Monitor application. This might give you a clue as to what the issue is. If it doesn't then post the sample here. Also, submit a bug to Apple with the sample.




回答3:


The following helped me A LOT - purge the workspace file.

Xcode 4 - slow performance

I didn't download the applet they're talking about but just manually doing it is working very effectively so far...

[Update: corrected the link]




回答4:


No this is not normal. I use a MAcbook Pro and it works quite normally, not sucking any more RAM than any other app. Occasionally it chews some CPU and RAM, but s restart and it's back to behaving. I put that down to XCode 4 still being quite new after the rebuild.

If you are getting this sort of behavior, I'd suggest completely uninstalling XCode and all developer tools. Make sure you get the SDKs and everything out. Reboot. Then reinstall and see if it improves.

Oh, and I use Git for all my projects.




回答5:


For me, Storyboard was almost unusable until I clicked on the View Controller and then "Editor - Resolve AutoLayout Issues - Clear All Constraints in View Controller".

I had been trying to fix layout issues and was also toggling the [3.5" / 4" Retina] button in the constraint tool bar (lower-right of the Storyboard window).

Once I cleared this, Xcode performance was back to 100%.



来源:https://stackoverflow.com/questions/6225603/xcode-4-became-extremely-slow-and-kills-my-hard-drive

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!