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.int32_json; | 5 library protoc.benchmark.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 int fields. | 12 /// A benchmark that deserializes a grid of int fields. |
12 class Int32Benchmark extends Benchmark { | 13 class Int32Benchmark 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 int lastFieldTag; | 17 int lastFieldTag; |
17 | 18 |
18 Int32Benchmark(this.width, this.height) : super($id); | 19 Int32Benchmark(this.width, this.height) : super($id); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 71 |
71 @override | 72 @override |
72 measureSample(Sample s) => int32ReadsPerMillisecond(s); | 73 measureSample(Sample s) => int32ReadsPerMillisecond(s); |
73 | 74 |
74 @override | 75 @override |
75 get measureSampleUnits => "int32 reads/ms"; | 76 get measureSampleUnits => "int32 reads/ms"; |
76 | 77 |
77 static const $id = BenchmarkID.READ_INT32_FIELDS_JSON; | 78 static const $id = BenchmarkID.READ_INT32_FIELDS_JSON; |
78 static final $type = new BenchmarkType($id, $create); | 79 static final $type = new BenchmarkType($id, $create); |
79 | 80 |
80 static $create(Request r) { | 81 static Int32Benchmark $create(Request r) { |
81 assert(r.params.hasInt32FieldCount()); | 82 assert(r.params.hasInt32FieldCount()); |
82 assert(r.params.hasMessageCount()); | 83 assert(r.params.hasMessageCount()); |
83 return new Int32Benchmark(r.params.int32FieldCount, r.params.messageCount); | 84 return new Int32Benchmark(r.params.int32FieldCount, r.params.messageCount); |
84 } | 85 } |
85 } | 86 } |
OLD | NEW |