Add build-after-edit benchmark (#107192)

* Add build-after-edit benchmark

* Clean up analyzer warnings

* Restore line break
This commit is contained in:
Alexander Aprelev 2022-07-06 19:19:07 -07:00 committed by GitHub
parent 1c4339974d
commit 9d00787791
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1335,6 +1335,21 @@ class CompileTest {
...compileSecondDebug,
};
final File mainDart = File('$testDirectory/lib/main.dart');
if (mainDart.existsSync()) {
final List<int> bytes = mainDart.readAsBytesSync();
// "Touch" the file
mainDart.writeAsStringSync(' ', mode: FileMode.append, flush: true);
// Build after "edit" without clean should be faster than first build
final Map<String, dynamic> compileAfterEditDebug = await _compileDebug(
clean: false,
metricKey: 'debug_compile_after_edit_millis',
);
metrics.addAll(compileAfterEditDebug);
// Revert the changes
mainDart.writeAsBytesSync(bytes, flush: true);
}
return TaskResult.success(metrics, benchmarkScoreKeys: metrics.keys.toList());
});
}