| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library server.performance.local; |
| 6 |
| 7 import 'benchmark_scenario.dart'; |
| 8 |
| 9 main(List<String> args) async { |
| 10 String pathRepository = args[0]; |
| 11 String pathServer = '$pathRepository/pkg/analysis_server'; |
| 12 String pathAnalyzer = '$pathRepository/pkg/analyzer'; |
| 13 { |
| 14 String now = new DateTime.now().toUtc().toIso8601String(); |
| 15 print('Benchmark started: $now'); |
| 16 print(''); |
| 17 print(''); |
| 18 } |
| 19 |
| 20 { |
| 21 String id = 'local-initialAnalysis-1'; |
| 22 String description = r''' |
| 23 1. Start server, set 'analyzer' analysis root. |
| 24 2. Measure the time to finish initial analysis. |
| 25 3. Shutdown the server. |
| 26 4. Go to (1). |
| 27 '''; |
| 28 List<int> times = await BenchmarkScenario |
| 29 .start_waitInitialAnalysis_shutdown( |
| 30 roots: [pathAnalyzer], numOfRepeats: 3); |
| 31 printBenchmarkResults(id, description, times); |
| 32 } |
| 33 |
| 34 { |
| 35 String id = 'local-initialAnalysis-2'; |
| 36 String description = r''' |
| 37 1. Start server, set 'analyzer' and 'analysis_server' analysis roots. |
| 38 2. Measure the time to finish initial analysis. |
| 39 3. Shutdown the server. |
| 40 4. Go to (1). |
| 41 '''; |
| 42 List<int> times = await BenchmarkScenario |
| 43 .start_waitInitialAnalysis_shutdown( |
| 44 roots: [pathAnalyzer, pathServer], numOfRepeats: 3); |
| 45 printBenchmarkResults(id, description, times); |
| 46 } |
| 47 |
| 48 { |
| 49 String id = 'local-change-1'; |
| 50 String description = r''' |
| 51 1. Open 'analyzer'. |
| 52 2. Change a method body in src/task/dart.dart. |
| 53 3. Measure the time to finish analysis. |
| 54 4. Rollback changes to the file and wait for analysis. |
| 55 5. Go to (2). |
| 56 '''; |
| 57 List<int> times = await new BenchmarkScenario().waitAnalyze_change_analyze( |
| 58 roots: [pathAnalyzer], |
| 59 file: '$pathAnalyzer/lib/src/task/dart.dart', |
| 60 fileChange: new FileChange( |
| 61 afterStr: 'if (hasDirectiveChange) {', insertStr: 'print(12345);'), |
| 62 numOfRepeats: 10); |
| 63 printBenchmarkResults(id, description, times); |
| 64 } |
| 65 |
| 66 { |
| 67 String id = 'local-change-2'; |
| 68 String description = r''' |
| 69 1. Open 'analyzer'. |
| 70 2. Change the name of a public method in src/task/dart.dart. |
| 71 3. Measure the time to finish analysis. |
| 72 4. Rollback changes to the file and wait for analysis. |
| 73 5. Go to (2). |
| 74 '''; |
| 75 List<int> times = await new BenchmarkScenario().waitAnalyze_change_analyze( |
| 76 roots: [pathAnalyzer], |
| 77 file: '$pathAnalyzer/lib/src/task/dart.dart', |
| 78 fileChange: new FileChange( |
| 79 afterStr: 'resolveDirective(An', |
| 80 afterStrBack: 3, |
| 81 insertStr: 'NewName'), |
| 82 numOfRepeats: 5); |
| 83 printBenchmarkResults(id, description, times); |
| 84 } |
| 85 |
| 86 { |
| 87 String id = 'local-completion-1'; |
| 88 String description = r''' |
| 89 1. Open 'analyzer'. |
| 90 2. Change a method body in src/task/dart.dart. |
| 91 3. Request code completion in this method and measure time to get results. |
| 92 4. Rollback changes to the file and wait for analysis. |
| 93 5. Go to (2). |
| 94 '''; |
| 95 List<int> times = await new BenchmarkScenario() |
| 96 .waitAnalyze_change_getCompletion( |
| 97 roots: [pathAnalyzer], |
| 98 file: '$pathAnalyzer/lib/src/task/dart.dart', |
| 99 fileChange: new FileChange( |
| 100 afterStr: 'if (hasDirectiveChange) {', |
| 101 insertStr: 'print(12345);'), |
| 102 completeAfterStr: 'print(12345);', |
| 103 numOfRepeats: 10); |
| 104 printBenchmarkResults(id, description, times); |
| 105 } |
| 106 |
| 107 { |
| 108 String id = 'local-completion-2'; |
| 109 String description = r''' |
| 110 1. Open 'analyzer'. |
| 111 2. Change the name of a public method in src/task/dart.dart. |
| 112 3. Request code completion in this method and measure time to get results. |
| 113 4. Rollback changes to the file and wait for analysis. |
| 114 5. Go to (2). |
| 115 '''; |
| 116 List<int> times = await new BenchmarkScenario() |
| 117 .waitAnalyze_change_getCompletion( |
| 118 roots: [pathAnalyzer], |
| 119 file: '$pathAnalyzer/lib/src/task/dart.dart', |
| 120 fileChange: new FileChange( |
| 121 afterStr: 'DeltaResult validate(In', |
| 122 afterStrBack: 3, |
| 123 insertStr: 'NewName'), |
| 124 completeAfterStr: 'if (hasDirectiveChange) {', |
| 125 numOfRepeats: 5); |
| 126 printBenchmarkResults(id, description, times); |
| 127 } |
| 128 |
| 129 { |
| 130 String id = 'local-completion-3'; |
| 131 String description = r''' |
| 132 1. Open 'analysis_server' and 'analyzer'. |
| 133 2. Change a method body in src/task/dart.dart. |
| 134 3. Request code completion in this method and measure time to get results. |
| 135 4. Rollback changes to the file and wait for analysis. |
| 136 5. Go to (2). |
| 137 '''; |
| 138 List<int> times = await new BenchmarkScenario() |
| 139 .waitAnalyze_change_getCompletion( |
| 140 roots: [pathServer, pathAnalyzer], |
| 141 file: '$pathAnalyzer/lib/src/task/dart.dart', |
| 142 fileChange: new FileChange( |
| 143 afterStr: 'if (hasDirectiveChange) {', |
| 144 insertStr: 'print(12345);'), |
| 145 completeAfterStr: 'print(12345);', |
| 146 numOfRepeats: 10); |
| 147 printBenchmarkResults(id, description, times); |
| 148 } |
| 149 |
| 150 { |
| 151 String id = 'local-completion-4'; |
| 152 String description = r''' |
| 153 1. Open 'analysis_server' and 'analyzer'. |
| 154 2. Change the name of a public method in src/task/dart.dart. |
| 155 3. Request code completion in this method and measure time to get results. |
| 156 4. Rollback changes to the file and wait for analysis. |
| 157 5. Go to (2). |
| 158 '''; |
| 159 List<int> times = await new BenchmarkScenario() |
| 160 .waitAnalyze_change_getCompletion( |
| 161 roots: [pathServer, pathAnalyzer], |
| 162 file: '$pathAnalyzer/lib/src/task/dart.dart', |
| 163 fileChange: new FileChange( |
| 164 afterStr: 'DeltaResult validate(In', |
| 165 afterStrBack: 3, |
| 166 insertStr: 'NewName'), |
| 167 completeAfterStr: 'if (hasDirectiveChange) {', |
| 168 numOfRepeats: 5); |
| 169 printBenchmarkResults(id, description, times); |
| 170 } |
| 171 } |
| OLD | NEW |