[devicelab] opt gallery benchmarks and platform view test into merged thread mode. (#152940)

Testing for https://github.com/flutter/flutter/issues/150525

Benchmark testing and sanity checking before I flip the default for iOS.
This commit is contained in:
Jonah Williams 2024-08-06 13:43:08 -07:00 committed by GitHub
parent 8329f67639
commit 6cea3d6a3d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 8 deletions

View File

@ -17,6 +17,7 @@ class NewGalleryPerfTest extends PerfTest {
'test_driver/transitions_perf.dart',
timelineFileName,
dartDefine: dartDefine,
createPlatforms: <String>['android', 'ios', 'web']
createPlatforms: <String>['android', 'ios', 'web'],
enableMergedPlatformThread: true,
);
}

View File

@ -60,6 +60,7 @@ TaskFunction createUiKitViewScrollPerfTest({bool? enableImpeller}) {
testDriver: 'test_driver/scroll_perf_test.dart',
needsFullTimeline: false,
enableImpeller: enableImpeller,
enableMergedPlatformThread: true,
).run;
}
@ -809,10 +810,11 @@ Map<String, dynamic> _average(List<Map<String, dynamic>> results, int iterations
}
/// Opens the file at testDirectory + 'ios/Runner/Info.plist'
/// and adds the following entry to the application.
/// <FTLDisablePartialRepaint/>
/// <true/>
void _disablePartialRepaint(String testDirectory) {
/// and adds additional manifest settings.
void _updateManifestSettings(String testDirectory, {
required bool disablePartialRepaint,
required bool platformThreadMerged
}) {
final String manifestPath = path.join(
testDirectory, 'ios', 'Runner', 'Info.plist');
final File file = File(manifestPath);
@ -824,7 +826,10 @@ void _disablePartialRepaint(String testDirectory) {
final String xmlStr = file.readAsStringSync();
final XmlDocument xmlDoc = XmlDocument.parse(xmlStr);
final List<(String, String)> keyPairs = <(String, String)>[
('FLTDisablePartialRepaint', 'true'),
if (disablePartialRepaint)
('FLTDisablePartialRepaint', disablePartialRepaint.toString()),
if (platformThreadMerged)
('FLTEnableMergedPlatformUIThread', platformThreadMerged.toString())
];
final XmlElement applicationNode =
@ -1222,6 +1227,7 @@ class PerfTest {
this.enableImpeller,
this.forceOpenGLES,
this.disablePartialRepaint = false,
this.enableMergedPlatformThread = false,
this.createPlatforms = const <String>[],
}): _resultFilename = resultFilename;
@ -1242,6 +1248,7 @@ class PerfTest {
this.enableImpeller,
this.forceOpenGLES,
this.disablePartialRepaint = false,
this.enableMergedPlatformThread = false,
this.createPlatforms = const <String>[],
}) : saveTraceFile = false, timelineFileName = null, _resultFilename = resultFilename;
@ -1285,6 +1292,9 @@ class PerfTest {
/// Whether partial repaint functionality should be disabled (iOS only).
final bool disablePartialRepaint;
/// Whether the UI thread should be the platform thread.
final bool enableMergedPlatformThread;
/// Number of seconds to time out the test after, allowing debug callbacks to run.
final int? timeoutSeconds;
@ -1380,9 +1390,13 @@ class PerfTest {
_addOpenGLESToManifest(testDirectory);
}
}
if (disablePartialRepaint) {
if (disablePartialRepaint || enableMergedPlatformThread) {
changedPlist = true;
_disablePartialRepaint(testDirectory);
_updateManifestSettings(
testDirectory,
disablePartialRepaint: disablePartialRepaint,
platformThreadMerged: enableMergedPlatformThread
);
}
final List<String> options = <String>[