XCode debug performance issues

Background

XCode is really slow to handle OS Signals. When a signal occurs some communication is done between the app and the XCode development environment. The slower the connection the higher the impact is: from running in a simulator that has almost no impact to running on physical phones over a slow WIFI which can have significant impact.

This problem is increased by the way Golang handles threads which causes an increased amount of signals.

This problem only affects when running in XCode, and should not have any impact on production apps.

The problem have been described in the following issue (external link):

https://github.com/golang/go/issues/57651

Solution

When running in XCode set the environment variable:

GODEBUG=asyncpreemptoff=1

This will reduce the number of signals that Golang sends and reduce the impact of the issue in XCode.