| 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 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; | |
| 10 | |
| 11 import 'benchmark_scenario.dart'; | 9 import 'benchmark_scenario.dart'; |
| 12 import 'memory_tests.dart'; | 10 import 'memory_tests.dart'; |
| 13 | 11 |
| 14 main(List<String> args) async { | 12 main(List<String> args) async { |
| 15 int length = args.length; | 13 int length = args.length; |
| 16 if (length < 1) { | 14 if (length < 1) { |
| 17 print('Usage: dart benchmark_local.dart path_to_np8080 (an example ngdart pr
oject)' | 15 print( |
| 16 'Usage: dart benchmark_local.dart path_to_np8080 (an example ngdart proj
ect)' |
| 18 ' [benchmark_id]'); | 17 ' [benchmark_id]'); |
| 19 return; | 18 return; |
| 20 } | 19 } |
| 21 paths = new PathHolder(projectPath: args[0]); | 20 paths = new PathHolder(projectPath: args[0]); |
| 22 String id = args.length >= 2 ? args[1] : null; | 21 String id = args.length >= 2 ? args[1] : null; |
| 23 if (id == null) { | 22 if (id == null) { |
| 24 for (String id in benchmarks.keys) { | 23 for (String id in benchmarks.keys) { |
| 25 BenchmarkFunction benchmark = benchmarks[id]; | 24 BenchmarkFunction benchmark = benchmarks[id]; |
| 26 await benchmark(id); | 25 await benchmark(id); |
| 27 } | 26 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 48 1. Open 'packages/np8080'. | 47 1. Open 'packages/np8080'. |
| 49 2. Add an @Output to the class | 48 2. Add an @Output to the class |
| 50 3. Measure the time to finish analysis. | 49 3. Measure the time to finish analysis. |
| 51 4. Rollback changes to the file and wait for analysis. | 50 4. Rollback changes to the file and wait for analysis. |
| 52 5. Go to (2). | 51 5. Go to (2). |
| 53 '''; | 52 '''; |
| 54 List<int> times = await new BenchmarkScenario().waitAnalyze_change_analyze( | 53 List<int> times = await new BenchmarkScenario().waitAnalyze_change_analyze( |
| 55 roots: [paths.packageNp8080], | 54 roots: [paths.packageNp8080], |
| 56 file: paths.editorDart, | 55 file: paths.editorDart, |
| 57 fileChange: new FileChange( | 56 fileChange: new FileChange( |
| 58 afterStr: 'showPreview = false;', insertStr: '@Output() EventEmitter<i
nt> myEventEmitter;'), | 57 afterStr: 'showPreview = false;', |
| 58 insertStr: '@Output() EventEmitter<int> myEventEmitter;'), |
| 59 numOfRepeats: 10); | 59 numOfRepeats: 10); |
| 60 printBenchmarkResults(id, description, times); | 60 printBenchmarkResults(id, description, times); |
| 61 } | 61 } |
| 62 | 62 |
| 63 Future run_ng_change_html(String id) async { | 63 Future run_ng_change_html(String id) async { |
| 64 String description = r''' | 64 String description = r''' |
| 65 1. Open 'packages/np8080'. | 65 1. Open 'packages/np8080'. |
| 66 2. Change the contents of a mustache | 66 2. Change the contents of a mustache |
| 67 3. Measure the time to finish analysis. | 67 3. Measure the time to finish analysis. |
| 68 4. Rollback changes to the file and wait for analysis. | 68 4. Rollback changes to the file and wait for analysis. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 String editorHtml; | 108 String editorHtml; |
| 109 String editorDart; | 109 String editorDart; |
| 110 String packageNp8080; | 110 String packageNp8080; |
| 111 | 111 |
| 112 PathHolder({String projectPath}) { | 112 PathHolder({String projectPath}) { |
| 113 editorHtml = '$projectPath/lib/editor/editor_component.html'; | 113 editorHtml = '$projectPath/lib/editor/editor_component.html'; |
| 114 editorDart = '$projectPath/lib/editor/editor_component.dart'; | 114 editorDart = '$projectPath/lib/editor/editor_component.dart'; |
| 115 packageNp8080 = projectPath; | 115 packageNp8080 = projectPath; |
| 116 } | 116 } |
| 117 } | 117 } |
| OLD | NEW |