OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 protoc.benchmark.suite.json; | 5 library protoc.benchmark.suite.json; |
6 | 6 |
7 import '../benchmarks/int32_json.dart'; | 7 import '../benchmarks/int32_json.dart'; |
8 import '../benchmarks/repeated_int32_json.dart'; | 8 import '../benchmarks/repeated_int32_json.dart'; |
9 import '../generated/benchmark.pb.dart' show Request, Suite; | 9 import '../generated/benchmark.pb.dart' show Request, Suite; |
10 | 10 |
11 final jsonSuite = () { | 11 final jsonSuite = () { |
12 var suite = new Suite(); | 12 var suite = new Suite(); |
13 suite.requests.addAll([ | 13 suite.requests.addAll([ |
14 _newRequest(1, 100), | 14 _newRequest(1, 100), |
| 15 _newRequest(2, 100), |
15 _newRequest(10, 100), | 16 _newRequest(10, 100), |
| 17 _newRequest(10, 200), |
16 _newRepeatedRequest(1, 100), | 18 _newRepeatedRequest(1, 100), |
| 19 _newRepeatedRequest(2, 100), |
17 _newRepeatedRequest(10, 100), | 20 _newRepeatedRequest(10, 100), |
| 21 _newRepeatedRequest(10, 200), |
18 ]); | 22 ]); |
19 | 23 |
20 // Growth in width (more ints in each repeated field) | |
21 for (var i = 10; i <= 50; i += 10) { | |
22 suite.requests.add(_newRepeatedRequest(i, 100, once: true)); | |
23 } | |
24 | |
25 // Growth in height (more messagse) | |
26 for (var i = 100; i <= 500; i += 100) { | |
27 suite.requests.add(_newRepeatedRequest(10, i, once: true)); | |
28 } | |
29 | |
30 return suite; | 24 return suite; |
31 }(); | 25 }(); |
32 | 26 |
33 _newRequest(int width, int height) => | 27 _newRequest(int width, int height) => |
34 new Int32Benchmark(width, height).makeRequest(); | 28 new Int32Benchmark(width, height).makeRequest(); |
35 | 29 |
36 _newRepeatedRequest(int width, int height, {bool once: false}) => | 30 _newRepeatedRequest(int width, int height) => |
37 new RepeatedInt32Benchmark(width, height) | 31 new RepeatedInt32Benchmark(width, height).makeRequest(); |
38 .makeRequest(new Duration(milliseconds: 200), once ? 1 : 3); | |
OLD | NEW |