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.repeated_int32_json; | 5 library protoc.benchmark.repeated_int32_json; |
6 | 6 |
7 import '../benchmark.dart'; | 7 import '../benchmark.dart'; |
8 import '../generated/benchmark.pb.dart' show BenchmarkID, Request, Params, Sampl
e; | 8 import '../generated/benchmark.pb.dart' |
| 9 show BenchmarkID, Request, Params, Sample; |
9 import '../generated/int32grid.pb.dart' as pb; | 10 import '../generated/int32grid.pb.dart' as pb; |
10 | 11 |
11 /// A benchmark that deserializes a grid of repeated ints. | 12 /// A benchmark that deserializes a grid of repeated ints. |
12 class RepeatedInt32Benchmark extends Benchmark { | 13 class RepeatedInt32Benchmark extends Benchmark { |
13 final int width; | 14 final int width; |
14 final int height; | 15 final int height; |
15 String json; | 16 String json; |
16 | 17 |
17 RepeatedInt32Benchmark(this.width, this.height) : super($id); | 18 RepeatedInt32Benchmark(this.width, this.height) : super($id); |
18 | 19 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 } | 62 } |
62 | 63 |
63 @override | 64 @override |
64 measureSample(Sample s) => int32ReadsPerMillisecond(s); | 65 measureSample(Sample s) => int32ReadsPerMillisecond(s); |
65 | 66 |
66 @override | 67 @override |
67 get measureSampleUnits => "int32 reads/ms"; | 68 get measureSampleUnits => "int32 reads/ms"; |
68 | 69 |
69 static const $id = BenchmarkID.READ_INT32_REPEATED_JSON; | 70 static const $id = BenchmarkID.READ_INT32_REPEATED_JSON; |
70 static final $type = new BenchmarkType($id, $create); | 71 static final $type = new BenchmarkType($id, $create); |
71 static $create(Request r) { | 72 static RepeatedInt32Benchmark $create(Request r) { |
72 assert(r.params.hasInt32RepeatCount()); | 73 assert(r.params.hasInt32RepeatCount()); |
73 assert(r.params.hasMessageCount()); | 74 assert(r.params.hasMessageCount()); |
74 return new RepeatedInt32Benchmark( | 75 return new RepeatedInt32Benchmark( |
75 r.params.int32RepeatCount, r.params.messageCount); | 76 r.params.int32RepeatCount, r.params.messageCount); |
76 } | 77 } |
77 } | 78 } |
OLD | NEW |