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_int64_json; | 5 library protoc.benchmark.repeated_int64_json; |
6 | 6 |
7 import 'package:fixnum/fixnum.dart'; | 7 import 'package:fixnum/fixnum.dart'; |
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 repeated ints. | 14 /// A benchmark that deserializes a grid of repeated ints. |
14 class RepeatedInt64Benchmark extends Benchmark { | 15 class RepeatedInt64Benchmark 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 | 19 |
19 RepeatedInt64Benchmark(this.width, this.height) : super($id); | 20 RepeatedInt64Benchmark(this.width, this.height) : super($id); |
20 | 21 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 } | 64 } |
64 | 65 |
65 @override | 66 @override |
66 measureSample(Sample s) => int64ReadsPerMillisecond(s); | 67 measureSample(Sample s) => int64ReadsPerMillisecond(s); |
67 | 68 |
68 @override | 69 @override |
69 get measureSampleUnits => "int64 reads/ms"; | 70 get measureSampleUnits => "int64 reads/ms"; |
70 | 71 |
71 static const $id = BenchmarkID.READ_INT64_REPEATED_JSON; | 72 static const $id = BenchmarkID.READ_INT64_REPEATED_JSON; |
72 static final $type = new BenchmarkType($id, $create); | 73 static final $type = new BenchmarkType($id, $create); |
73 static $create(Request r) { | 74 static RepeatedInt64Benchmark $create(Request r) { |
74 assert(r.params.hasInt64RepeatCount()); | 75 assert(r.params.hasInt64RepeatCount()); |
75 assert(r.params.hasMessageCount()); | 76 assert(r.params.hasMessageCount()); |
76 return new RepeatedInt64Benchmark( | 77 return new RepeatedInt64Benchmark( |
77 r.params.int64RepeatCount, r.params.messageCount); | 78 r.params.int64RepeatCount, r.params.messageCount); |
78 } | 79 } |
79 } | 80 } |
OLD | NEW |