While I'm not sure about running Instruments from the command line, with Xcode 12 you can write performance tests for animations and memory, which would let you have the same sort of performance checks you're interested in.
From the
Xcode 12 Beta release notes:
Performance XCTests now support animation performance testing when using XCTOSSignpostMetric coupled with an animation os_signpost interval. The performance measurements returned include duration, three hitch-related metrics, and frame rate. To create an animation os_signpost interval, create a custom interval or use one of the provided UIKit intervals. The following shows an example performance test that measures the animation performance of scrolling an application. (55644042)
Code Block swiftfunc testScrollingAnimationPerformance() throws { |
let table = app.tables.firstMatch |
measure(metrics: [XCTOSSignpostMetric.scrollDecelerationMetric]) { |
table.swipeUp(velocity: .fast) |
} |
} |
We have a session in WWDC2020's testing collection that goes over how to use these new APIs. You can
check it out here.
Also, here's
a link to the performance testing documentation we have as well, which includes the list of metrics you can write performance tests around.
I hope this helps :)