From f8ef2f92946baa127381bcd2ef4d169702cf4e63 Mon Sep 17 00:00:00 2001 From: Huy Nguyen Date: Fri, 11 Jan 2019 11:14:48 -0800 Subject: [PATCH] Add experiment to skip waiting until all updates of collection/table view are committed in -accessibilityElements The wait was introduced in #1217 which blocks the main thread until updates are proccessed. We suspect this causes perf regressions accross the app and need to confirm this via an experiment. --- Schemas/configuration.json | 6 ++++-- Source/ASCollectionView.mm | 4 +++- Source/ASExperimentalFeatures.h | 1 + Source/ASExperimentalFeatures.mm | 3 ++- Source/ASTableView.mm | 4 +++- Tests/ASConfigurationTests.mm | 6 ++++-- 6 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Schemas/configuration.json b/Schemas/configuration.json index 334e8a2fc..8e3ee7da4 100644 --- a/Schemas/configuration.json +++ b/Schemas/configuration.json @@ -19,10 +19,12 @@ "exp_unfair_lock", "exp_infer_layer_defaults", "exp_network_image_queue", - "exp_dealloc_queue_v2", "exp_collection_teardown", "exp_framesetter_cache", - "exp_skip_clear_data" + "exp_skip_clear_data", + "exp_did_enter_preload_skip_asm_layout", + "exp_disable_a11y_cache", + "exp_skip_a11y_wait" ] } } diff --git a/Source/ASCollectionView.mm b/Source/ASCollectionView.mm index 59e4ef4fa..de52298bc 100644 --- a/Source/ASCollectionView.mm +++ b/Source/ASCollectionView.mm @@ -2465,7 +2465,9 @@ - (void)setPrefetchingEnabled:(BOOL)prefetchingEnabled - (NSArray *)accessibilityElements { - [self waitUntilAllUpdatesAreCommitted]; + if (!ASActivateExperimentalFeature(ASExperimentalSkipAccessibilityWait)) { + [self waitUntilAllUpdatesAreCommitted]; + } return [super accessibilityElements]; } diff --git a/Source/ASExperimentalFeatures.h b/Source/ASExperimentalFeatures.h index 8b85d312a..7d3558e5a 100644 --- a/Source/ASExperimentalFeatures.h +++ b/Source/ASExperimentalFeatures.h @@ -29,6 +29,7 @@ typedef NS_OPTIONS(NSUInteger, ASExperimentalFeatures) { ASExperimentalSkipClearData = 1 << 8, // exp_skip_clear_data ASExperimentalDidEnterPreloadSkipASMLayout = 1 << 9, // exp_did_enter_preload_skip_asm_layout ASExperimentalDisableAccessibilityCache = 1 << 10, // exp_disable_a11y_cache + ASExperimentalSkipAccessibilityWait = 1 << 11, // exp_skip_a11y_wait ASExperimentalFeatureAll = 0xFFFFFFFF }; diff --git a/Source/ASExperimentalFeatures.mm b/Source/ASExperimentalFeatures.mm index e1e3fce55..824f19953 100644 --- a/Source/ASExperimentalFeatures.mm +++ b/Source/ASExperimentalFeatures.mm @@ -22,7 +22,8 @@ @"exp_framesetter_cache", @"exp_skip_clear_data", @"exp_did_enter_preload_skip_asm_layout", - @"exp_disable_a11y_cache"])); + @"exp_disable_a11y_cache", + @"exp_skip_a11y_wait"])); if (flags == ASExperimentalFeatureAll) { return allNames; diff --git a/Source/ASTableView.mm b/Source/ASTableView.mm index 4850495bb..7fb279877 100644 --- a/Source/ASTableView.mm +++ b/Source/ASTableView.mm @@ -2004,7 +2004,9 @@ - (void)didMoveToSuperview - (NSArray *)accessibilityElements { - [self waitUntilAllUpdatesAreCommitted]; + if (!ASActivateExperimentalFeature(ASExperimentalSkipAccessibilityWait)) { + [self waitUntilAllUpdatesAreCommitted]; + } return [super accessibilityElements]; } diff --git a/Tests/ASConfigurationTests.mm b/Tests/ASConfigurationTests.mm index 7ea48ddaf..f483d43ab 100644 --- a/Tests/ASConfigurationTests.mm +++ b/Tests/ASConfigurationTests.mm @@ -28,7 +28,8 @@ ASExperimentalFramesetterCache, ASExperimentalSkipClearData, ASExperimentalDidEnterPreloadSkipASMLayout, - ASExperimentalDisableAccessibilityCache + ASExperimentalDisableAccessibilityCache, + ASExperimentalSkipAccessibilityWait, }; @interface ASConfigurationTests : ASTestCase @@ -51,7 +52,8 @@ + (NSArray *)names { @"exp_framesetter_cache", @"exp_skip_clear_data", @"exp_did_enter_preload_skip_asm_layout", - @"exp_disable_a11y_cache" + @"exp_disable_a11y_cache", + @"exp_skip_a11y_wait" ]; }