Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Unified Diff: pkg/analysis_server/benchmark/perf/benchmark_local.dart

Issue 2110443002: Add a flutter benchmark; refactor (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/benchmark/perf/benchmark_local.dart
diff --git a/pkg/analysis_server/benchmark/perf/benchmark_local.dart b/pkg/analysis_server/benchmark/perf/benchmark_local.dart
index 7b17591d2a88d84b737ea645700829f31d4c60bf..a6fd493461fb5011732244522f240ac6643719ad 100644
--- a/pkg/analysis_server/benchmark/perf/benchmark_local.dart
+++ b/pkg/analysis_server/benchmark/perf/benchmark_local.dart
@@ -4,192 +4,236 @@
library server.performance.local;
+import 'dart:async';
+
import 'package:analysis_server/plugin/protocol/protocol.dart';
import 'benchmark_scenario.dart';
main(List<String> args) async {
- String pathRepository = args[0];
- String pathServer = '$pathRepository/pkg/analysis_server';
- String pathAnalyzer = '$pathRepository/pkg/analyzer';
- {
- String now = new DateTime.now().toUtc().toIso8601String();
- print('Benchmark started: $now');
- print('');
- print('');
+ int length = args.length;
+ if (length < 1) {
+ print(
+ 'Usage: dart benchmark_local.dart path_to_sdk_checkout [path_to_flutter_checkout]');
+ return;
+ } else if (length == 1) {
+ paths = new PathHolder(sdkPath: args[0]);
+ } else {
+ paths = new PathHolder(sdkPath: args[0], flutterPath: args[1]);
}
+ String now = new DateTime.now().toUtc().toIso8601String();
+ print('Benchmark started: $now');
+ print('');
+ print('');
+ await run_local_initialAnalysis_1();
+ await run_local_initialAnalysis_2();
+ await run_local_initialAnalysis_3();
+ await run_local_change_1();
+ await run_local_change_2();
+ await run_local_completion_1();
+ await run_local_completion_2();
+ await run_local_completion_3();
+ await run_local_completion_4();
+ await run_local_refactoring_1();
+}
- {
- String id = 'local-initialAnalysis-1';
- String description = r'''
-1. Start server, set 'analyzer' analysis root.
-2. Measure the time to finish initial analysis.
-3. Shutdown the server.
-4. Go to (1).
-''';
- List<int> times = await BenchmarkScenario
- .start_waitInitialAnalysis_shutdown(
- roots: [pathAnalyzer], numOfRepeats: 3);
- printBenchmarkResults(id, description, times);
- }
+PathHolder paths;
- {
- String id = 'local-initialAnalysis-2';
- String description = r'''
-1. Start server, set 'analyzer' and 'analysis_server' analysis roots.
-2. Measure the time to finish initial analysis.
-3. Shutdown the server.
-4. Go to (1).
-''';
- List<int> times = await BenchmarkScenario
- .start_waitInitialAnalysis_shutdown(
- roots: [pathAnalyzer, pathServer], numOfRepeats: 3);
- printBenchmarkResults(id, description, times);
- }
-
- {
- String id = 'local-change-1';
- String description = r'''
+Future run_local_change_1() async {
+ String id = 'local-change-1';
+ String description = r'''
1. Open 'analyzer'.
2. Change a method body in src/task/dart.dart.
3. Measure the time to finish analysis.
4. Rollback changes to the file and wait for analysis.
5. Go to (2).
''';
- List<int> times = await new BenchmarkScenario().waitAnalyze_change_analyze(
- roots: [pathAnalyzer],
- file: '$pathAnalyzer/lib/src/task/dart.dart',
- fileChange: new FileChange(
- afterStr: 'if (hasDirectiveChange) {', insertStr: 'print(12345);'),
- numOfRepeats: 10);
- printBenchmarkResults(id, description, times);
- }
+ List<int> times = await new BenchmarkScenario().waitAnalyze_change_analyze(
+ roots: [paths.analyzer],
+ file: '${paths.analyzer}/lib/src/task/dart.dart',
+ fileChange: new FileChange(
+ afterStr: 'if (hasDirectiveChange) {', insertStr: 'print(12345);'),
+ numOfRepeats: 10);
+ printBenchmarkResults(id, description, times);
+}
- {
- String id = 'local-change-2';
- String description = r'''
+Future run_local_change_2() async {
+ String id = 'local-change-2';
+ String description = r'''
1. Open 'analyzer'.
2. Change the name of a public method in src/task/dart.dart.
3. Measure the time to finish analysis.
4. Rollback changes to the file and wait for analysis.
5. Go to (2).
''';
- List<int> times = await new BenchmarkScenario().waitAnalyze_change_analyze(
- roots: [pathAnalyzer],
- file: '$pathAnalyzer/lib/src/task/dart.dart',
- fileChange: new FileChange(
- afterStr: 'resolveDirective(An',
- afterStrBack: 3,
- insertStr: 'NewName'),
- numOfRepeats: 5);
- printBenchmarkResults(id, description, times);
- }
+ List<int> times = await new BenchmarkScenario().waitAnalyze_change_analyze(
+ roots: [paths.analyzer],
+ file: '${paths.analyzer}/lib/src/task/dart.dart',
+ fileChange: new FileChange(
+ afterStr: 'resolveDirective(An',
+ afterStrBack: 3,
+ insertStr: 'NewName'),
+ numOfRepeats: 5);
+ printBenchmarkResults(id, description, times);
+}
- {
- String id = 'local-completion-1';
- String description = r'''
+Future run_local_completion_1() async {
+ String id = 'local-completion-1';
+ String description = r'''
1. Open 'analyzer'.
2. Change a method body in src/task/dart.dart.
3. Request code completion in this method and measure time to get results.
4. Rollback changes to the file and wait for analysis.
5. Go to (2).
''';
- List<int> times = await new BenchmarkScenario()
- .waitAnalyze_change_getCompletion(
- roots: [pathAnalyzer],
- file: '$pathAnalyzer/lib/src/task/dart.dart',
- fileChange: new FileChange(
- afterStr: 'if (hasDirectiveChange) {',
- insertStr: 'print(12345);'),
- completeAfterStr: 'print(12345);',
- numOfRepeats: 10);
- printBenchmarkResults(id, description, times);
- }
+ List<int> times = await new BenchmarkScenario()
+ .waitAnalyze_change_getCompletion(
+ roots: [paths.analyzer],
+ file: '${paths.analyzer}/lib/src/task/dart.dart',
+ fileChange: new FileChange(
+ afterStr: 'if (hasDirectiveChange) {',
+ insertStr: 'print(12345);'),
+ completeAfterStr: 'print(12345);',
+ numOfRepeats: 10);
+ printBenchmarkResults(id, description, times);
+}
- {
- String id = 'local-completion-2';
- String description = r'''
+Future run_local_completion_2() async {
+ String id = 'local-completion-2';
+ String description = r'''
1. Open 'analyzer'.
2. Change the name of a public method in src/task/dart.dart.
3. Request code completion in this method and measure time to get results.
4. Rollback changes to the file and wait for analysis.
5. Go to (2).
''';
- List<int> times = await new BenchmarkScenario()
- .waitAnalyze_change_getCompletion(
- roots: [pathAnalyzer],
- file: '$pathAnalyzer/lib/src/task/dart.dart',
- fileChange: new FileChange(
- afterStr: 'DeltaResult validate(In',
- afterStrBack: 3,
- insertStr: 'NewName'),
- completeAfterStr: 'if (hasDirectiveChange) {',
- numOfRepeats: 5);
- printBenchmarkResults(id, description, times);
- }
+ List<int> times = await new BenchmarkScenario()
+ .waitAnalyze_change_getCompletion(
+ roots: [paths.analyzer],
+ file: '${paths.analyzer}/lib/src/task/dart.dart',
+ fileChange: new FileChange(
+ afterStr: 'DeltaResult validate(In',
+ afterStrBack: 3,
+ insertStr: 'NewName'),
+ completeAfterStr: 'if (hasDirectiveChange) {',
+ numOfRepeats: 5);
+ printBenchmarkResults(id, description, times);
+}
- {
- String id = 'local-completion-3';
- String description = r'''
+Future run_local_completion_3() async {
+ String id = 'local-completion-3';
+ String description = r'''
1. Open 'analysis_server' and 'analyzer'.
2. Change a method body in src/task/dart.dart.
3. Request code completion in this method and measure time to get results.
4. Rollback changes to the file and wait for analysis.
5. Go to (2).
''';
- List<int> times = await new BenchmarkScenario()
- .waitAnalyze_change_getCompletion(
- roots: [pathServer, pathAnalyzer],
- file: '$pathAnalyzer/lib/src/task/dart.dart',
- fileChange: new FileChange(
- afterStr: 'if (hasDirectiveChange) {',
- insertStr: 'print(12345);'),
- completeAfterStr: 'print(12345);',
- numOfRepeats: 10);
- printBenchmarkResults(id, description, times);
- }
+ List<int> times = await new BenchmarkScenario()
+ .waitAnalyze_change_getCompletion(
+ roots: [paths.analysisServer, paths.analyzer],
+ file: '${paths.analyzer}/lib/src/task/dart.dart',
+ fileChange: new FileChange(
+ afterStr: 'if (hasDirectiveChange) {',
+ insertStr: 'print(12345);'),
+ completeAfterStr: 'print(12345);',
+ numOfRepeats: 10);
+ printBenchmarkResults(id, description, times);
+}
- {
- String id = 'local-completion-4';
- String description = r'''
+Future run_local_completion_4() async {
+ String id = 'local-completion-4';
+ String description = r'''
1. Open 'analysis_server' and 'analyzer'.
2. Change the name of a public method in src/task/dart.dart.
3. Request code completion in this method and measure time to get results.
4. Rollback changes to the file and wait for analysis.
5. Go to (2).
''';
- List<int> times = await new BenchmarkScenario()
- .waitAnalyze_change_getCompletion(
- roots: [pathServer, pathAnalyzer],
- file: '$pathAnalyzer/lib/src/task/dart.dart',
- fileChange: new FileChange(
- afterStr: 'DeltaResult validate(In',
- afterStrBack: 3,
- insertStr: 'NewName'),
- completeAfterStr: 'if (hasDirectiveChange) {',
- numOfRepeats: 5);
- printBenchmarkResults(id, description, times);
- }
+ List<int> times = await new BenchmarkScenario()
+ .waitAnalyze_change_getCompletion(
+ roots: [paths.analysisServer, paths.analyzer],
+ file: '${paths.analyzer}/lib/src/task/dart.dart',
+ fileChange: new FileChange(
+ afterStr: 'DeltaResult validate(In',
+ afterStrBack: 3,
+ insertStr: 'NewName'),
+ completeAfterStr: 'if (hasDirectiveChange) {',
+ numOfRepeats: 5);
+ printBenchmarkResults(id, description, times);
+}
- {
- String id = 'local-refactoring-1';
- String description = r'''
+Future run_local_initialAnalysis_1() async {
+ String id = 'local-initialAnalysis-1';
+ String description = r'''
+1. Start server, set 'analyzer' analysis root.
+2. Measure the time to finish initial analysis.
+3. Shutdown the server.
+4. Go to (1).
+''';
+ List<int> times = await BenchmarkScenario.start_waitInitialAnalysis_shutdown(
+ roots: [paths.analyzer], numOfRepeats: 3);
+ printBenchmarkResults(id, description, times);
+}
+
+Future run_local_initialAnalysis_2() async {
+ String id = 'local-initialAnalysis-2';
+ String description = r'''
+1. Start server, set 'analyzer' and 'analysis_server' analysis roots.
+2. Measure the time to finish initial analysis.
+3. Shutdown the server.
+4. Go to (1).
+''';
+ List<int> times = await BenchmarkScenario.start_waitInitialAnalysis_shutdown(
+ roots: [paths.analyzer, paths.analysisServer], numOfRepeats: 3);
+ printBenchmarkResults(id, description, times);
+}
+
+Future run_local_initialAnalysis_3() async {
+ String id = 'local-initialAnalysis-3';
+ String description = r'''
+1. Start server, set 'hello_world' and 'stocks' analysis roots.
+2. Measure the time to finish initial analysis.
+3. Shutdown the server.
+4. Go to (1).
+''';
+ List<int> times = await BenchmarkScenario.start_waitInitialAnalysis_shutdown(
+ roots: [paths.flutterHelloWorld, paths.flutterStocks], numOfRepeats: 3);
+ printBenchmarkResults(id, description, times);
+}
+
+Future run_local_refactoring_1() async {
+ String id = 'local-refactoring-1';
+ String description = r'''
1. Open 'analyzer'.
2. Change the name of a public method in src/context/cache.dart.
3. Request rename refactoring for `getSourcesWithFullName` and measure time to get results.
4. Rollback changes to the file and wait for analysis.
5. Go to (2).
''';
- List<int> times = await new BenchmarkScenario()
- .waitAnalyze_change_getRefactoring(
- roots: [pathAnalyzer],
- file: '$pathAnalyzer/lib/src/context/cache.dart',
- fileChange: new FileChange(
- afterStr: 'getState(An', afterStrBack: 3, insertStr: 'NewName'),
- refactoringAtStr: 'getSourcesWithFullName(String path)',
- refactoringKind: RefactoringKind.RENAME,
- refactoringOptions: new RenameOptions('getSourcesWithFullName2'),
- numOfRepeats: 5);
- printBenchmarkResults(id, description, times);
+ List<int> times = await new BenchmarkScenario()
+ .waitAnalyze_change_getRefactoring(
+ roots: [paths.analyzer],
+ file: '${paths.analyzer}/lib/src/context/cache.dart',
+ fileChange: new FileChange(
+ afterStr: 'getState(An', afterStrBack: 3, insertStr: 'NewName'),
+ refactoringAtStr: 'getSourcesWithFullName(String path)',
+ refactoringKind: RefactoringKind.RENAME,
+ refactoringOptions: new RenameOptions('getSourcesWithFullName2'),
+ numOfRepeats: 5);
+ printBenchmarkResults(id, description, times);
+}
+
+class PathHolder {
+ String analysisServer;
+ String analyzer;
+ String flutterHelloWorld;
+ String flutterStocks;
+
+ PathHolder({String sdkPath, String flutterPath}) {
+ analysisServer = '$sdkPath/pkg/analysis_server';
+ analyzer = '$sdkPath/pkg/analyzer';
+ flutterHelloWorld = '$flutterPath/examples/hello_world';
+ flutterStocks = '$flutterPath/examples/stocks';
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698