All performance tests in Xcode can have baselines attached to them, which are stored results that you consider representative of your app’s performance as things stand. The baseline is useful because it gives Xcode a measuring point for all other changes you make: if you accidentally change your code so that it runs slower, Xcode will consider your performance test to be a failure.
To set a baseline for a performance test, first make sure it has been run at least once. You should see a gray bar next to the test saying “No baseline average for time”, but if you click the gray diamond to the left of your test a balloon appears offering more information.
To set a baseline, click the Set Baseline button inside that balloon. You’ll see a “Max STDDEV” field set to 10% by default – that’s how much variance Xcode allows before it considers a test to have failed, but you can change it however you want. Broadly speaking, extremely fast code should have a higher standard deviation allowance than slower code, only because extremely fast code is likely to show more variance due to system conditions.
Sponsored You’re already busy updating your app for Swift 4.2 and iOS 12, so why not let Instabug help you find and fix bugs? Add just two lines of code to your project and receive comprehensive reports with all the feedback you need to ship a world-class app – click here to learn more!
Available from iOS
Did this solution work for you? Please pass it on!
Other people are reading…
About the Swift Knowledge Base
This is part of the Swift Knowledge Base, a free, searchable collection of solutions for common iOS questions.
Build for watchOS
Take your existing Swift skills to Apple's tiniest platform – check out Hacking with watchOS!