Swift Ios App performance configuration - ios

First of all, I'm sorry to ask a somewhat vague question but I'm only doing it because I'm clueless to what might be causing the problem.
I've been building an app with Sprite Kit and it has worked great. I've made some additions to code at suddently I see a dramatic decrease in performance. I have rolled back all my code changes but the performance didn't go up. I'm left clueless to what's wrong.
After hidious debugging I've noticed that the performance problem only affects run and test builds. If I do a profiling build, the app behaves as normally = with high performance. So this would suggest that my problem is somewhere in the build configuration but I'm completely new to ios build environment configurations.
Can anybody suggest what might be the cause of this? Where should I start looking? I have my background in Java 5 and the compiler and other settings are quite strange to me.

The default setup is to have a Debug config and a Release config, where Debug is configured with no optimizations, and Release does include optimizations. Optimizing often makes it hard to use the debugger, which is why unoptimized code is preferred there.
By default, Run, Test, and Analyze use the Debug config, Profile and Archive use the Release config. Your change in behavior could come from lots of differences: you may have had it configured before to build for Run in Release mode. You may have had a subproject built in Release mode that is now in Debug. You may have made a coding change that is very slow unless the optimizer is used. (Since you say you rolled back the code, this last one is unlikely, but check your version control and see if you changed any project settings.)
If you're seeing weird "it wasn't like that before" behavior when you think you've put everything back, make sure you're rebuilding everything. Delete your Derived Data directory. You can determine where it is in Preferences, Locations. "Delete your Derived Data directory" is the Xcode-equivalent of "try rebooting." It's the most common way to fix strange "Xcode isn't working right" problems. In fact, I put my Derived Data in /tmp/build so that it gets deleted every time I reboot (and so the path is easier for me to remember).

Related

Xamarin android doesn't always deploy latest code changes

I'm new to Xamarin/Android, and so far it's been a pretty frustrating experience, compounded by code/AXML changes seemingly not being built or deployed to the emulator. I often find that a change I've just made seems to get ignored when I build and run the app.
My suspicions were confirmed when it started throwing an exception on a line in MainActivity.cs that I had commented out. Cleaning and rebuilding didn't help, and in the end deleted the bin and obj folders and uninstalled the app off the emulator for good measure (not sure which of these fixed it though).
Is it just me or is this a common issue? Is there anything I can do to prevent it from happening? I'm using VS2015 Community by the way.
Go to 'Tools/Configuration Manager' and make sure that both 'Build' and 'Deploy' options are checked for 'YourApp.Android' for active solution configuration and active solution platform. Then do 'Clean solution' and 'Rebuild solution', it should always work.
It looks like this is a common issue, as yet unresolved.
One of the comments in the above thread suggested that the problem can occur if you've only changed C# code, and unless you also "touch" one of the xml or axml files then the latest version won't be deployed. This seemed to do the trick in my case but it could have been a coincidence - Xamarin seems to be a temperamental beast, and will randomly fail to build or deploy on occasion, perhaps depending on the wind direction, or colour of my underwear that day.
I'm still in the early stages of learning Xamarin/Android, but if I don't enjoy the experience then I'll be jumping ship to Android Studio (although I'd prefer to stick with C# if I can).

How to get to the bottom of random crashes

I am working with my app in test flight now and I have experienced this maybe only one time myself. How can I get to the bottom of a rare crash without it being hooked up to the computer? The only information is that it occasionally will freeze, but other than that it doesn't seem to be happening with a specific action. How do I debug this?
Here are some approaches:
Write log files to the disk, which you can later sync. or send to a server for investigating which operations succeeded before it crashed
Integrate a custom (such as KSCrash, Crashlytics, etc.) crash reporter tool that allows you to see a backtrace (Note though that enabling Bitcode will make things much harder)
Try to reproduce the problem in the simulator (try different builds, debug build, release build, send memory warnings, etc.)
Try to reproduce with a computer connected. Interactive debugging makes things so much easier.
Good luck!

Launching an app from Xcode performance

I was wondering if there was a performance difference if you launch an app on your iPhone from Xcode vs starting it up from the phone itself. When you launch it from Xcode it seems to be on a debug "lite" mode in the sense that you are getting data to the console.
Are there any performance differences when you don't launch from Xcode ?
There are performance differences. You wouldn't be able to put a general number on how big they are, because they depend on a number of factors. The differences can go from not noticeable to significantly slowing down even a fairly simple application.
First you have three different operating modes:
A release build that is installed to the device directly
This will enable things such as compiler optimizations. For exact settings have a look at your project file.
A debug build run with a debugger attached (e.g. by launching from Xcode)
On top of your application missing compiler optimizations because of being built with the debug configuration, the debugger can be an additional performance drain.
From personal experience I know that having a lot of breakpoints (especially symbolic ones) or watchpoints, can make things noticably slower. You may experience similar problems if you are doing intensive logging.
In some projects debug code is also compiled to work slightly differently than in production. For example if using a logging framework such as CocoaLumberjack, you would set a more verbose log level, which can again be more processing work.
A debug build run without a debugger attached (e.g. by installing through Xcode and launching separately)
You will not have any compiler optimizations and still work on Debug configuration logic, but your application isn't additionally slowed down by the debugger
Actually there could be a lot of difference between debug and release codes.
By default debug build don't use optimizations but add debug symbols to the binaries created. These two can have dramatic effect on the app performance, size and some.
You can go and look at the project settings file to understand what exactly are the differences.
But again to your question, there could be performance changes between debug and release.

XCode Autosave Broken?

I recently changed from developing iOS apps on a MacMini to a new MacBook Pro (2.2 GHz Intel Core i7). While working in XCode, I occasionally get pop-ups when the system is apparently trying to do an autosave and runs into a problem.
The pop-ups state "The document [filename] could not be autosaved. The file has been changed by another application. Click Save Anyway to keep your changes and save the changes made by the other application as a version, or click Revert to keep the changes from the other application and save your changes as a version."
Examples of the filename are: AppDelegate.m, MyLoginViewController.m. There shouldn't be anything else that is changing those files.
I can't do anything within XCode until I choose one of the options. Sometimes it seems like the system is trying to overwrite my newest code with an old version of my code, sometimes it seems like it is trying to save my newest code. So, sometimes Revert is what I need to do to keep my current version, and other times Save Anyway is what I need to do. However, sometimes, I can't tell what the system is trying to do and I choose the wrong option and lose hours of work.
This has happened numerous times over a span of three weeks.
I am using OS X 10.7.2 and XCode 4.2.1. The code is on my MacBook's hard drive.
Does anybody have any idea why this is happening?
Thank you.
This is a huge problem, and it looks like it's Lion's force-fed "file-versioning" that is destroying work.
I typed quite a bit of code into my source and saved it regularly (pretty much after every complete paragraph). Suddenly I couldn't find an entire section that I'd just written. I even did a project-wide search, in case I'd accidentally entered it in the wrong file. Suddenly Xcode raised a dialog saying it couldn't autosave the file because it had been modified externally. Did I want to "revert", or save what was in the editor?
In the several times I've seen this come up on two systems over the past few weeks, I've chosen to save what's in the editor, thinking that obviously it must be the most recent version. WRONG. I hit "Revert", and the block of code reappeared.
There is so much wrong here, it's hard to decide what's the most offensive.
Confirming that this happens on XCode 4.3.2 on an iMac running 10.7.4.
I have found that this bug may be related to having the same file open in more than one tab or window in XCode. If you carefully avoid ever having more than one window open on a given file at a time I think you can avoid this problem. However, it undermines the very useful ability to apple-click method names to navigate to the file that contains them.
This has cost me hours of original work and been the source of immense frustration. The derisive comments from others are simply inadequate.
I heard they had a complicated fix for it already at Apple, but unfortunately, it was "accidentally lost" and now they can't remember which files need what changes to make it work again. :-/

Delphi 6 - Bugs disappear when I compile multiple times

My Delphi installation has been going downhill for the past few months. It seems though that every so often when I build a release it has strange errors in it which are resolved if I build, then compile, then build, compile, etc.
I've talked to another developer who thinks that this is a compiler error. This sort of degrading performance over time has happened on other computers to us too.
What does stack overflow think could be the problem.
What I've seen most is a case where multiple versions of the same units/dcus exist in different folders/paths, and depending on almost insignificant variations the compiler/linker uses a different path and picks different versions of the units to build the exe.
I would make a huge Spring clean-up, scrutinize the lib/search paths, remove all dcus and make sure there is no duplicate versions of any unit.
And, agreed, reinstalling Delphi could help start with a clean state.
I agree with #François about the DCUs, but also want to point out an observation: sometimes it matters what was built prior to what you're building. i.e. if you have several projects that contain source code that results in various .dcu/bpl files being created in a common directory, but the project that you're concerned with doesn't explicitly call for them to be rebuilt, then you're going to end up with whatever is there. If you clear the dcus/dcps prior to building, and then find that your project doesn't build, then you are missing a uses/requires clause somewhere. Every project shoudl be able to build on a "clean slate", and not rely on leftover binaries.
That's not much to go on, but it sounds like a classic case of "bit rot". Too many things interacting in too many ways for too much time under a poorly-designed OS, leading to strange forms of data corruption.
First thing I'd do is uninstall Delphi and reinstall. If that doesn't work, try reinstalling Windows. (If it's been around long enough for this to be happening, you're probably due for an OS reinstall anyway.) And if that doesn't work, contact Embarcadero tech support.

Resources