Add optional performance profiling utilities and UI performance tests #16383
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds a fully optional performance profiling layer to the WooCommerce iOS app.
The goal is to give maintainers and contributors a clean, isolated and reusable way to:
os_signpostevents for Instruments.What this PR does
Adds
PerformanceLoggerWooCommerce/Classes/Profiling/PerformanceLogger.swiftos_signpostwith several predefined categories (catalog load, image decode, cart / checkout, etc.).Adds
OptimizedImageCache(optional micro-optimization)WooCommerce/Classes/Profiling/OptimizedImageCache.swiftUIImages in anNSCache.image(for:sourceProvider:completion:)API.Adds UI performance tests
WooCommerce/WooCommerceUITests/Performance/PerformanceUITests.swiftXCTMetric:Adds a profiling helper script
Scripts/profiling/run_profiling.shprofiling_results/<timestamp>/.Updates
.gitignoreprofiling_results/to avoid committing trace bundles and profiling artifacts.Why it’s safe
.gitignoreupdate.Profiling/Performancegroups and are completely opt-in.Test Steps
To validate this change:
Build the app and tests
WooCommerce.xcworkspacein Xcode.WooCommercescheme.WooCommerceUITestsscheme and build as well.Run a performance UI test from Xcode
WooCommerceUITestsscheme selected:PerformanceUITests.testScenario1_BrowseProductCatalogon an iOS Simulator (e.g. iPhone 15).(Optional) Run all scenarios via the script
chmod +x Scripts/profiling/run_profiling.sh./Scripts/profiling/run_profiling.sh allprofiling_results/<timestamp>/containing traces / logs.