Swift version: 5.0
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.
SPONSOR Tired of wasting time debugging your Swift app? Instabug’s SDK is here to help you minimize your debugging time by providing you with complete device details, network logs, and reproduction steps with every bug report. All data is attached automatically. It only takes a line of code to setup. Get started for free.
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.