Skip to content

Commit

Permalink
Add experiment to skip waiting until all updates of collection/table …
Browse files Browse the repository at this point in the history
…view are committed in -accessibilityElements

The wait was introduced in TextureGroup#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.
  • Loading branch information
nguyenhuy committed Jan 11, 2019
1 parent 2d43f46 commit f8ef2f9
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 7 deletions.
6 changes: 4 additions & 2 deletions Schemas/configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
}
Expand Down
4 changes: 3 additions & 1 deletion Source/ASCollectionView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2465,7 +2465,9 @@ - (void)setPrefetchingEnabled:(BOOL)prefetchingEnabled

- (NSArray *)accessibilityElements
{
[self waitUntilAllUpdatesAreCommitted];
if (!ASActivateExperimentalFeature(ASExperimentalSkipAccessibilityWait)) {
[self waitUntilAllUpdatesAreCommitted];
}
return [super accessibilityElements];
}

Expand Down
1 change: 1 addition & 0 deletions Source/ASExperimentalFeatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

Expand Down
3 changes: 2 additions & 1 deletion Source/ASExperimentalFeatures.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion Source/ASTableView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2004,7 +2004,9 @@ - (void)didMoveToSuperview

- (NSArray *)accessibilityElements
{
[self waitUntilAllUpdatesAreCommitted];
if (!ASActivateExperimentalFeature(ASExperimentalSkipAccessibilityWait)) {
[self waitUntilAllUpdatesAreCommitted];
}
return [super accessibilityElements];
}

Expand Down
6 changes: 4 additions & 2 deletions Tests/ASConfigurationTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
ASExperimentalFramesetterCache,
ASExperimentalSkipClearData,
ASExperimentalDidEnterPreloadSkipASMLayout,
ASExperimentalDisableAccessibilityCache
ASExperimentalDisableAccessibilityCache,
ASExperimentalSkipAccessibilityWait,
};

@interface ASConfigurationTests : ASTestCase <ASConfigurationDelegate>
Expand All @@ -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"
];
}

Expand Down

0 comments on commit f8ef2f9

Please sign in to comment.