Xcode suddenly becomes very slow - xcode

My Xcode speed has come down to a crawl. I have no idea why. CPU activity is very low on both cores, gobs of memory.
It's almost as if it's waiting for something but I have no idea what. I have disconnected all USB and FireWire devices but it helped only a little bit.
Any ideas?

First thing I'd look at is the HDD. Is it constantly being accessed? If so, it would indicate several possible things - memory shortage and lots of swapping, hard drive free space shortage cause it to hunt for space, heavy fragementation etc.
If thats not it, perhaps Xcode is running something in the background. Do you have any custom scripts you have added which could have done something?
have you rebooted?

It sounds like you have predictive compilation turned on in the Xcode preferences.

I know this is a relatively old post, but I had a different problem that was causing XCode to be sluggish. I am running 4.1. If you navigate to your project file, secondary click and select "Show Package Contents", then delete the *.xcworkspace file, XCode speeds up drastically. No more rainbow pinwheel of death.

It may very well be downloading documentation updates. They're fairly large. Open Xcode's (note, big X, little c :-)) preferences and go to the documentation tab. I'll bet there's a circular progress indicator beside one of the doc sets.

If you have lots and lots of code (or at least 10 000++ lines of code), the predictive compilation setting gets a lot to do. Turn this off as mentioned and you've at least eliminated that variable.

For me, this just happened when I started editing a new file. It was caused by a single function -- something in that function caused the compiler to freak out. After 20 minutes of compiling, Xcode gave me that message.
So if something like this starts right when you start editing a file, try commenting out the problem areas and trying again.

Related

Xcode 9 performance issue

Have anyone tried out the new Color Asset Catalogue feature in Xcode 9. For me every time I edit something on this like adding or editing a colour asset, I have to wait for 10-15 seconds while Xcode shows the coloured progress and does not allow any interaction.
At the same time being highly annoying, it is also highly counter-productive. I also found IB to be generally too slow after updating to Xcode 9.
Are these known issues ? Is there a solution to this?
i asked apple about the hangs and crashes that keep on occurring on Xcode 9, and they replied:
First, quit Xcode. And then temporarily move aside
UserInterfaceState.xcuserstate so that new user state is created.
It can be found here
path_to/$WORKSPACE.xcworkspace/xcuserdata/$USER.xcuserdatad/UserInterfaceState.xcuserstate
(if it is an .xcodeproject, it will be deep in the project.xcworkspace
directory).
this worked for me with autocomplete problems and switching between files. hope it helps you out as well.
Xcode 9 is borderline unusable for me too at times. The worst is how long it takes to open/edit a storyboard file and also run the simulator. Even autocomplete and switching between code files is lagging a lot for me, much more so than past versions. I imagine Apple knows about it considering the Apple development forums are full of threads about how the newest update is unacceptable but as for how long it will take for them to do anything about it, who knows. It's an absolute nightmare for iOS developer's productivity to say the least.
My solution is to just quit Xcode when it starts getting too slow. It's a pain, obviously, but usually helps short term.

My Netbeans Editor Lags Heavily (Running on Mac, Programming in C)

I'm a student who uses Netbeans on Mac to Program in C. Due to my previous experience with Java, I really like the feeling of Netbeans IDE. However, I recently noticed, as my projects gets longer and longer, simply coding the plain text is starting to lag heavily, inside the IDE editor.
For example, when I type in any words, even if just comments, if feels like it takes the computer a second or two to respond to every type. Things get even worse when I try to scroll up and down in my code, the response takes a long time, making it feel really bad.
I thought this might be a problem that the IDE haven't been given enough memory. However, after increasing the memory given to the program, it still lags heavily.
Is this all due to the fact running Netbeans to program in C is a bad idea? Or is it something else going wrong in my case?
Thank you very much!
Let's see...
The result is kind of clear. There just wasn't really any viable plan to make it work...
I started working on another computer instead. It seems mac just don't really want to work with netbeans, especially about C.
In my case (MacOS Monterey) the problem was the font size. The more I increased it, the worse the IDE would work.
Over 14 font size the lag is pretty extreme.
I would recommend using another IDE as it looks like this problem has not been fixed even in the latest version.

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.
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:
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)?
Defragmentation (iDefrag - full defragmentation with rebuiling B-Tree and Metadata) - Did NOT help at all.
System cleaning and antivirus scanning - CleanMyMac, MacKeeper - did NOT help at all.
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.
Organizer - Projects - cleaned all Projects from the list except opened ones - small improvement
File - Source control - disable Show Remote Status (was enabled somehow, thx to ThomasW for pointing to that), but did NOT help much.
Xcode - Preference - General - Disable Auto-Save (prompt only) and both Live Issues (In Editors, In Issue Navigator) - quite a bit of improvement.
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.
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.
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]
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.
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%.

Xcode Code Sense horribly broken?

Ever since I started using Xcode, I've experienced extremely annoying problems with Code Sense. The problem is that when Code Sense kicks in for code completion, sometimes the source code text below the line I'm working on goes "crazy". If I continue typing, the problem gets worse, and after a while the source code is completely screwed up (funny colors, missing lines and characters, ...). Strange enough, the source code itself is unaffected, because when I select another source file and then go back to the one I was working on, everything looks fine again.
The problem can be seen in this screencast: http://www.screencast.com/t/OGY3NWE5
Interesting facts:
This problem has occurred on 3 different machines, so it's not related to a corrupt installation.
Sometimes it's fine for a while (up to one hour) after launching Xcode, but once it starts happening, it's getting worse and worse, until Xcode is restarted. Then it's fine again (for a while)
I've searched the web for similar experiences, and I can't find anything. I would think that it is a known problem, since it occurs on 3 different Macs here (both running 10.5 and 10.6).
Anyone having the same problems? Or a suggestion for fixing this?
Yeah, it can be a real pain. I didn't find a 'fix for it as such, but I do a quick switch from implementation to header (or vice versa) and then back again using Command-option-up. The screen redraws and everything is fine again
Well, I finally (kind of) fixed this problem by simply turning off Quick Help. Previously, I left this on all the time, and it resulted in a very unstable code sense (to the point where Xcode simply became unusable).
This is not a real solution, but it should at least help people experiencing the same issue.
I wrote about it here
My issue was with localization. if your XIB file is localized using xcode 4's, then it was failing for me. removing the localization worked, though not a proper solution.

ReSharper sluggishness

I like ReSharper, but it is a total memory hog. It can quickly swell up and consume a half-gig of RAM without too much effort and bog down the IDE. Does anybody know of any way to configure it to be not as slow?
Turn off the on-the-fly compilation (which, unfortunately, is one of its best features)
The next release 4.5 is going to based around performance and memory footprint.
see Ilya Ryzhenkov's blog
Resharper 4.5 has been released
From my experience it is less of a memory hog, but i still can run out of memory.
I had an issue where it was taking upwards of 10 minutes to load a solution of 100+ projects. Once loaded VS performance would be ok, though it would oddly flutter back and forth between ok and really bad.
The short answer: Eliminating Resharper warnings seems to improve overall VS/R# performance.
The biggest problem ultimately was that we had a number of files of binary data (encrypted stuff) being included as embedded resources, which happened to have .xml extensions. Resharper was trying really really hard to analyze those files. Eventually it'd get through but would generate 100K+ errors in the process. Changing the extension to one Resharper did not automatically analyze (.bin in this case) solved the problem.
We still have about 10 files which when they or a file they depend on is edited performance tanks for a while. These files are the partial parts of a single class definition where each file averages 3000 LOC. Yes, that's right, it's about a 30K line class. It also happens to be rather poor code for other reasons, many of which Resharper flags making the right hand gutter bar practically a solid orange line. Editing often causes Resharper to reanalyze the whole thing. While that analysis runs, performance is noticeably affected.
I've come to the conclusion that the less errors/warnings there are for R# to identify, the better it performs. My anecdotal evidence gathered while cleaning up/refactoring this project seems to support it.
A lot of folks complain of perf problems with Resharper. If you have even a few big ugly code files with lots of Resharper warnings, then a little time spent cleaning that code up might yield better performance overall. It has for us.
Not sure how big your solutions are, but I stopped using 4.5 for the same reasons I stopped using all previous versions, memory usage.
Code analysis and unit test support was the main reason I bought it, turning it off means the rationale for using it is gone.
Workstation has 4GB of memory, and I can easily kill it with ReSharper when running our end-to-end stack in debuggers.
You can look how much memory ReSharper use.
ReSharper -> General -> Show managed memory usege in status bar.
If you are working on large source files, Resharper does get sluggish (I'm working on version 5.0 at the time of writing this).
You can view the memory usage of Resharper by clicking on Resharper options -> General -> Show memory use in status bar.
When I first did this, I noticed Resharper had clocked up hundreds of megabytes of memory usage! However, the next step worked for me in (temporarily) fixing the slugishness:
Right click the memory usage, and select "Collect garbage" - this seemed to fix the slugishness for me straight away.
Regarding memory hogging - I've found that my VS2008 memory footprint grows every time I close one solution and open another. This is true even if I close a solution and re-open that same solution.
The new ReSharper 4.5 works a lot better than the previous 4.x releases. I would recommend you try that one.
In previous versions I had the same problem, when 4.0 came out these problems have seemed to have gone away. Now with 4.1 i do not feel the huge slow down i used to have. My IDE does not freeze up anymore.
have you tried upgrading ?
Try the 4.5 beta. 4.1 was killing my 2GB dev machine, but it's back to running incredibly smoothly with the beta. Others have had the opposite experience, though, so YMMV.
Yes, 4.5 works much better. My understanding is that 4.5 was to address the performance issues.
Me and my colleagues are also having huge performance issues with ReSharper, just now my ReSharper took 1.1GB of memory. Visual Studio slows down specially when writing JavaScript, it's unbearable. You can turn of the on the fly compilation, but it's the best feature it has...
edit: Everybody in this thread seems to have ReShaprper 4.x, my version is 6.0.

Resources