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.int64_json; | 5 library protoc.benchmark.int64_json; |
6 | 6 |
7 import 'package:fixnum/fixnum.dart' show Int64; | 7 import 'package:fixnum/fixnum.dart' show Int64; |
8 | 8 |
9 import '../benchmark.dart'; | 9 import '../benchmark.dart'; |
10 import '../generated/benchmark.pb.dart' show BenchmarkID, Request, Params, Sampl
e; | 10 import '../generated/benchmark.pb.dart' |
| 11 show BenchmarkID, Request, Params, Sample; |
11 import '../generated/int64grid.pb.dart' as pb; | 12 import '../generated/int64grid.pb.dart' as pb; |
12 | 13 |
13 /// A benchmark that deserializes a grid of int fields. | 14 /// A benchmark that deserializes a grid of int fields. |
14 class Int64Benchmark extends Benchmark { | 15 class Int64Benchmark extends Benchmark { |
15 final int width; | 16 final int width; |
16 final int height; | 17 final int height; |
17 String json; | 18 String json; |
18 int lastFieldTag; | 19 int lastFieldTag; |
19 | 20 |
20 Int64Benchmark(this.width, this.height) : super($id); | 21 Int64Benchmark(this.width, this.height) : super($id); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 73 |
73 @override | 74 @override |
74 measureSample(Sample s) => int64ReadsPerMillisecond(s); | 75 measureSample(Sample s) => int64ReadsPerMillisecond(s); |
75 | 76 |
76 @override | 77 @override |
77 get measureSampleUnits => "int64 reads/ms"; | 78 get measureSampleUnits => "int64 reads/ms"; |
78 | 79 |
79 static const $id = BenchmarkID.READ_INT64_FIELDS_JSON; | 80 static const $id = BenchmarkID.READ_INT64_FIELDS_JSON; |
80 static final $type = new BenchmarkType($id, $create); | 81 static final $type = new BenchmarkType($id, $create); |
81 | 82 |
82 static $create(Request r) { | 83 static Int64Benchmark $create(Request r) { |
83 assert(r.params.hasInt64FieldCount()); | 84 assert(r.params.hasInt64FieldCount()); |
84 assert(r.params.hasMessageCount()); | 85 assert(r.params.hasMessageCount()); |
85 return new Int64Benchmark(r.params.int64FieldCount, r.params.messageCount); | 86 return new Int64Benchmark(r.params.int64FieldCount, r.params.messageCount); |
86 } | 87 } |
87 } | 88 } |
OLD | NEW |