I'm working on an iPhone game and have now a big problem.
The project is getting larger and larger. Now Xcode takes forever for indexing, typing is laggy, autocomplete takes some seconds, building the file takes forever and so on.
Im using Xcode 8 Beta 6, but that is not the problem. If i open another project which is not so big the performance is normal.
I deleted the files under DerivedData but that did not help.
My question is: In this big project I have one GameScene.swift file with 7500 lines of code. Is that causing the problem? Or should Xcode be able to perform this much code in one file and the problem is more the code itself? Ive read that for example the syntax of an array can cause the problem, or if you declare an array with 30 or more objects (both not the case for me).
I think it's something inside the code which causes the problem and not the size of the code - but I don't know how to find it out.
Edit: Oh, the process SourceKitService has almost always 100% CPU use.
Related
I've tried Swift3, it looked nice.
After adding some Swift code to existing Objc/C++ codebase (pretty large one), terrible debug delays began to happen.
If I write
assert(false);
somewhere, the message about it appears in console, and Xcode reaches breakpoint after 2 minutes (so I can see exact place of failure, observe variables and so on).
After discarding Swift code (so there're only Objc/C++ files), debugging is just 2-3 times faster.
I have to wait 30 seconds to reach function on button click:
After searching for it, I suppose the problem is with Xcode 8.3.2.
Have you met this problem?
Do you know of some new compiler/debugger flags, which speed up debugging?
Is it proper (for development process efficiency) to add Swift to such codebase?
This Issue Occurred On A SpriteKit Xcode Project
I have an issue with Swift where, once my project reaches a certain level of complexity where I have tons of classes and methods around, my autocompletion breaks so that "Jump To Definition" ceases to work and my IDE is reduced to the usefulness of a basic TextEditor/Notepad.
My code's color will change to white completely, which causes a lot of strain on my eyes, and this seems to only happen when I remove and add large blocks of code as I watch my CPU activity climb up to 75% usage on all CPU cores.
I think this started happening when I switched the target iOS from 9.3 over to 8.0. Is this an issue with the compiler trying to interpret old Swift syntax?
I also will have cases where I wait two minutes for minor changes to compile, only for the build to fail due to "Linker command failed with exit code", which is easily fixed by compiling twice.
Here's my specs:
OS X 10.11.4
Core i7 Skylake 4.0GHz
16 GB DDR4 RAM
256GB SSD
I'm thinking about building a system running OS X with dual processors which might alleviate the issue, since it can take upwards of 2 minutes just to compile code that's different by 1 line.
Okay, I found one solution which resolved my issue.
Remove All Emojis From Variable Names & .Swift File Names
Contrary to Apple's official Swift 2.0 textbook, DO NOT use ANY kind of Emoji's for things like Variable Names and Swift File Names UNLESS you know that the emoji you're using is a very old emoji (but even then, I wouldn't recommend it).
After opening my project in AppCode, AppCode had unicode problems with file names such as: foobar🔵.swift. It was very buggy and it would break Xcode later if I opened and saved a project with pre-existing emojis in AppCode.
So avoid using emojis in your code unless it's for strings like:
let someString = "⬛️🗡💣📚"
Welcome to Swift! Great language, awful tooling.
Joking aside, there are a couple of issues at play here. First off, syntax highlighting disappears when SourceKit crashes. SourceKit is the library which parses Swift on-the-fly so that Xcode can do things like indexing, syntax highlighting and code completion. It's a lot better than it used to be (using Swift 1.0 in Xcode was almost comical at times), but it's still far from perfect. Until SourceKit improves, you won't see much difference.
As for your build times, it's worth trying something like the Swift Build Time Analyzer to see which functions are taking a particularly long time to compile. I recently halved the compile time of the project I work on by removing all lazy vars set via closures. A recent compiler change made type inference for these sorts of closures incredibly slow, so each one was taking ~6 seconds to compile.
I'm stumped with an error I found and from my searches, only a few have also received it a long time ago and I'm not quite sure if / how a solution was achieved.
The error I'm getting in xcode is
Mprotect failed at 0xed50000 (length 212992) with errno 12
Mprotect remapping failed
The game works fine in the editor and all other platforms. This error is iOS specific and happens every session that goes past the login process (loads another scene) for > 10 seconds. The exact time is inconsistent. I say inconsistently because it doesn't seem to happen right after an interaction. My game does download data and images so my hunch (and a lousy hunch at that) is threading / wait time is the cause of the inconsistently.
Here's some of my search results
http://forum.unity3d.com/threads/mprotect-failed-at-0x51fa000.15858/
this is from all the way back from 2008 and it looked like it was a
hotfixed by Unity
http://forum.unity3d.com/threads/mprotect-remapping-failed.15443/
this is more of the same but a Unity dev did mention:
Workaround: don't allocate mono objects too frequently, reuse them if
possible (this would also improve your performance).
This is a little embarrassing since I'm a self taught Unity user but
what exactly does that mean and can I apply it to my problem?
My system info:
Currently on Unity 5.3 but has been happening since 5.2 Xcode is version 7.2 but has been happening since 7.0 I think My game is 2d, it uses NGUI, it downloads data and images from the internet.
Thank you so much for your read and time. Hope you can help!
I code in Javascript using the Appcelerator framework.
This AM I decided to open Xcode and turn on ARC based on some online advice.
Well it seems Xcode refactored all my original JS files into something I cannot understand or read.
This project has been something I've been working on for years. My last backup is from 6 months ago, so going back to that one is a very very painful option.
Is there any way to 'undo' the refactoring and bring back my original files. Either in Xcode, OS X or any kind of way. I'll do anything at this point, since I'm suicidal now and stepping outside to get some fresh air and relax :)
Thank you for any advice!!!!! I'll give away all my points to help fix this :)
I'm having a severe problem using the new versions of Xcode (4.4 & 4.5) in that, my project has a very large .sql database file stored in the project. This file cannot change, for many reasons... but it is +270Mb in size. This causes Xcode to hang on 'Indexing File...' and becomes completely slow and unresponsive to the point that I have to force quit the app, and cannot actually get any coding done. I have raised a bug report with Apple several times, but it is seemingly being ignored!
I do not want to disable Xcode indexing entirely as i find the code completion features incredibly useful.
My question is: Can i remove the database from the Xcode bundle resources, and then add it automatically at compile time?
Would appreciate any and all advice on how I could get round this problem.
Regards,
Sam
Incase anyone comes across this problem of Xcode indexing a huge unwanted file... I fixed it by setting the file type in Xcode to an 'MP3 Audio file'...
Doesn't seem to have any effect on the function of the .sql file once it's in the App, but stops Xcode trying to index it.
If anyone has a better solution for this, i'd love to hear it!