Skip to content

Commit 9d00787

Browse files
authored
Add build-after-edit benchmark (#107192)
* Add build-after-edit benchmark * Clean up analyzer warnings * Restore line break
1 parent 1c43399 commit 9d00787

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

dev/devicelab/lib/tasks/perf_tests.dart

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,6 +1335,21 @@ class CompileTest {
13351335
...compileSecondDebug,
13361336
};
13371337

1338+
final File mainDart = File('$testDirectory/lib/main.dart');
1339+
if (mainDart.existsSync()) {
1340+
final List<int> bytes = mainDart.readAsBytesSync();
1341+
// "Touch" the file
1342+
mainDart.writeAsStringSync(' ', mode: FileMode.append, flush: true);
1343+
// Build after "edit" without clean should be faster than first build
1344+
final Map<String, dynamic> compileAfterEditDebug = await _compileDebug(
1345+
clean: false,
1346+
metricKey: 'debug_compile_after_edit_millis',
1347+
);
1348+
metrics.addAll(compileAfterEditDebug);
1349+
// Revert the changes
1350+
mainDart.writeAsBytesSync(bytes, flush: true);
1351+
}
1352+
13381353
return TaskResult.success(metrics, benchmarkScoreKeys: metrics.keys.toList());
13391354
});
13401355
}

0 commit comments

Comments
 (0)