Why is XCode so slow?!! - BSTechReviews

Latest

Wednesday 30 August 2017

Why is XCode so slow?!!

So I have been working on iOS Applications for over 3+ years now and have had hands on experience with Objective-C and Swift both. But one thing is for sure, Objective-C wins it hands down when it comes to compatibility and support, and code completion, because since Swift had launched most developers across the world have been experiencing lot of lag in development time due to code completion issues on XCode having swift projects.

Image Credits: Krollontrack

Earlier we had compiler crashes happening, but that is because Swift had been just launched. After that, since the newer Swift versions are launching, I am sure most of your developers are experiencing issues with the development process taking time. Apps take ages to build. compile , execute and even archive for that matter!

Image Credits: MacStories

I happen to see some solutions from various users out there and most of them keep saying to clear the "Derived Data" folder on /Library/Developer/XCode/Derived Data , and the saved application state as well, but nothing works. Don't get so happy, because these are not solutions at all. It may temporarily fix the issue, but its not a 100% solution.

So most developers on iOS, happen to have a bug report section where they file bugs with Apple and they take them up with their Engineers and resolve issues. This particular slow down supposedly happens due to a service called "SourceKit"which is responsible for GIT and Code Completion on XCode and it keeps on restarting and killing the process repeatedly. If you are a user who uses a lot of GIT/Bitbucket/SVN remotes then this is bound to happen. If you dont use remote GIT then this is less likely but will happen. It causes enormous amount of CPU usage , sometimes even 150-200% utilisation.

Image Credits: Git

So don't need to fret, Apple and its team is diligently working on resolving this issue with the XCode team, but how long and when this will be fixed is unknown. Just some quick tips here to make sure things work fine for you.

1. Dont work with remote GITs and commits. If you want to do that, just copy over your project to another location, remove the git related files and work on it. When your done paste the files back to the folder where the remote git project was stored. For ex: if you are working on /documents/github/project -> Create a duplicate of this folder say at /documents/project and via terminal remove any git files. Now when your done finishing tasks on the /document/project files, then copy and paste this folder to the location /documents/github/project and committ the code there. This way you can work smoothly.

2. Second tip is to make sure USE ONLY VARIABLES that are REQUIRED. Do not keep creating tons of unused variables in your code, because each variable occupies memory if not used. It causes lot of load on the Swift Compiler thereby causing the hanging issues.

3. The new swift language totally relies on the "var or let" type , so developers tend to use AnyObject and let swift decide what data type to be assigned. You should use and define the exact data type at most places to avoid too much load on Swift to make decisions and slow down XCode.

4. Avoid using Safari, iCloud Drive when using XCode in the slow condition, this worsens things even more, when app switching. Use Google Chrome instead.

I hope some tips above can save you the frustration of coding iOS applications. iOS apps have the best User Experience so don't give up on it, and keep coding!







No comments:

Post a Comment