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.get_strings; | 5 library protoc.benchmark.get_strings; |
6 | 6 |
7 import '../benchmark.dart'; | 7 import '../benchmark.dart'; |
8 import '../generated/benchmark.pb.dart' | 8 import '../generated/benchmark.pb.dart' |
9 show BenchmarkID, Request, Params, Sample; | 9 show BenchmarkID, Request, Params, Sample; |
10 import '../generated/string_grid.pb.dart' as pb; | 10 import '../generated/string_grid.pb.dart' as pb; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 ok = ok && line.cell6.isEmpty; | 87 ok = ok && line.cell6.isEmpty; |
88 ok = ok && line.cell7.isEmpty; | 88 ok = ok && line.cell7.isEmpty; |
89 ok = ok && line.cell8.isEmpty; | 89 ok = ok && line.cell8.isEmpty; |
90 ok = ok && line.cell9.isEmpty; | 90 ok = ok && line.cell9.isEmpty; |
91 ok = ok && line.cell10.isEmpty; | 91 ok = ok && line.cell10.isEmpty; |
92 } | 92 } |
93 if (!ok) throw "failed"; | 93 if (!ok) throw "failed"; |
94 } | 94 } |
95 | 95 |
96 void _getStrings() { | 96 void _getStrings() { |
97 var expected = fillValue; | |
98 bool ok = true; | 97 bool ok = true; |
99 for (var line in grid.lines) { | 98 for (var line in grid.lines) { |
100 ok = ok && line.cell1.isNotEmpty; | 99 ok = ok && line.cell1.isNotEmpty; |
101 ok = ok && line.cell2.isNotEmpty; | 100 ok = ok && line.cell2.isNotEmpty; |
102 ok = ok && line.cell3.isNotEmpty; | 101 ok = ok && line.cell3.isNotEmpty; |
103 ok = ok && line.cell4.isNotEmpty; | 102 ok = ok && line.cell4.isNotEmpty; |
104 ok = ok && line.cell5.isNotEmpty; | 103 ok = ok && line.cell5.isNotEmpty; |
105 ok = ok && line.cell6.isNotEmpty; | 104 ok = ok && line.cell6.isNotEmpty; |
106 ok = ok && line.cell7.isNotEmpty; | 105 ok = ok && line.cell7.isNotEmpty; |
107 ok = ok && line.cell8.isNotEmpty; | 106 ok = ok && line.cell8.isNotEmpty; |
(...skipping 10 matching lines...) Expand all Loading... |
118 | 117 |
119 @override | 118 @override |
120 measureSample(Sample s) => stringReadsPerMillisecond(s); | 119 measureSample(Sample s) => stringReadsPerMillisecond(s); |
121 | 120 |
122 @override | 121 @override |
123 get measureSampleUnits => "string reads/ms"; | 122 get measureSampleUnits => "string reads/ms"; |
124 | 123 |
125 static const $id = BenchmarkID.GET_STRINGS; | 124 static const $id = BenchmarkID.GET_STRINGS; |
126 static final $type = new BenchmarkType($id, $create); | 125 static final $type = new BenchmarkType($id, $create); |
127 | 126 |
128 static $create(Request r) { | 127 static GetStringsBenchmark $create(Request r) { |
129 assert(r.params.hasMessageCount()); | 128 assert(r.params.hasMessageCount()); |
130 var value = null; | 129 var value = null; |
131 if (r.params.hasStringValue()) value = r.params.stringValue; | 130 if (r.params.hasStringValue()) value = r.params.stringValue; |
132 return new GetStringsBenchmark(r.params.messageCount, value); | 131 return new GetStringsBenchmark(r.params.messageCount, value); |
133 } | 132 } |
134 } | 133 } |
OLD | NEW |