| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library server.performance.local; | 5 library server.performance.local; |
| 6 | 6 |
| 7 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
| 8 |
| 7 import 'benchmark_scenario.dart'; | 9 import 'benchmark_scenario.dart'; |
| 8 | 10 |
| 9 main(List<String> args) async { | 11 main(List<String> args) async { |
| 10 String pathRepository = args[0]; | 12 String pathRepository = args[0]; |
| 11 String pathServer = '$pathRepository/pkg/analysis_server'; | 13 String pathServer = '$pathRepository/pkg/analysis_server'; |
| 12 String pathAnalyzer = '$pathRepository/pkg/analyzer'; | 14 String pathAnalyzer = '$pathRepository/pkg/analyzer'; |
| 13 { | 15 { |
| 14 String now = new DateTime.now().toUtc().toIso8601String(); | 16 String now = new DateTime.now().toUtc().toIso8601String(); |
| 15 print('Benchmark started: $now'); | 17 print('Benchmark started: $now'); |
| 16 print(''); | 18 print(''); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 roots: [pathServer, pathAnalyzer], | 163 roots: [pathServer, pathAnalyzer], |
| 162 file: '$pathAnalyzer/lib/src/task/dart.dart', | 164 file: '$pathAnalyzer/lib/src/task/dart.dart', |
| 163 fileChange: new FileChange( | 165 fileChange: new FileChange( |
| 164 afterStr: 'DeltaResult validate(In', | 166 afterStr: 'DeltaResult validate(In', |
| 165 afterStrBack: 3, | 167 afterStrBack: 3, |
| 166 insertStr: 'NewName'), | 168 insertStr: 'NewName'), |
| 167 completeAfterStr: 'if (hasDirectiveChange) {', | 169 completeAfterStr: 'if (hasDirectiveChange) {', |
| 168 numOfRepeats: 5); | 170 numOfRepeats: 5); |
| 169 printBenchmarkResults(id, description, times); | 171 printBenchmarkResults(id, description, times); |
| 170 } | 172 } |
| 173 |
| 174 { |
| 175 String id = 'local-refactoring-1'; |
| 176 String description = r''' |
| 177 1. Open 'analyzer'. |
| 178 2. Change the name of a public method in src/context/cache.dart. |
| 179 3. Request rename refactoring for `getSourcesWithFullName` and measure time to g
et results. |
| 180 4. Rollback changes to the file and wait for analysis. |
| 181 5. Go to (2). |
| 182 '''; |
| 183 List<int> times = await new BenchmarkScenario() |
| 184 .waitAnalyze_change_getRefactoring( |
| 185 roots: [pathAnalyzer], |
| 186 file: '$pathAnalyzer/lib/src/context/cache.dart', |
| 187 fileChange: new FileChange( |
| 188 afterStr: 'getState(An', afterStrBack: 3, insertStr: 'NewName'), |
| 189 refactoringAtStr: 'getSourcesWithFullName(String path)', |
| 190 refactoringKind: RefactoringKind.RENAME, |
| 191 refactoringOptions: new RenameOptions('getSourcesWithFullName2'), |
| 192 numOfRepeats: 5); |
| 193 printBenchmarkResults(id, description, times); |
| 194 } |
| 171 } | 195 } |
| OLD | NEW |