OLD | NEW |
1 #!/usr/bin/env dart | 1 #!/usr/bin/env dart |
2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
5 | 5 |
6 library BenchmarkTests; | 6 library BenchmarkTests; |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 import 'dart:math' as Math; | 8 import 'dart:math' as Math; |
9 import '../../../lib/utf/utf.dart' as SE; | 9 import '../../../lib/convert/convert.dart' as SE; |
10 part 'benchmark_runner.dart'; | 10 part 'benchmark_runner.dart'; |
11 | 11 |
12 void main() { | 12 void main() { |
13 | 13 |
14 final List<int> testEnglishUtf8 = const<int> [ | 14 final List<int> testEnglishUtf8 = const<int> [ |
15 0x54, 0x68, 0x65, 0x20, 0x71, 0x75, 0x69, 0x63, | 15 0x54, 0x68, 0x65, 0x20, 0x71, 0x75, 0x69, 0x63, |
16 0x6b, 0x20, 0x62, 0x72, 0x6f, 0x77, 0x6e, 0x20, | 16 0x6b, 0x20, 0x62, 0x72, 0x6f, 0x77, 0x6e, 0x20, |
17 0x66, 0x6f, 0x78, 0x20, 0x6a, 0x75, 0x6d, 0x70, | 17 0x66, 0x6f, 0x78, 0x20, 0x6a, 0x75, 0x6d, 0x70, |
18 0x73, 0x20, 0x6f, 0x76, 0x65, 0x72, 0x20, 0x74, | 18 0x73, 0x20, 0x6f, 0x76, 0x65, 0x72, 0x20, 0x74, |
19 0x68, 0x65, 0x20, 0x6c, 0x61, 0x7a, 0x79, 0x20, | 19 0x68, 0x65, 0x20, 0x6c, 0x61, 0x7a, 0x79, 0x20, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 0x82, 0xa2, 0xe3, 0x82, 0xb5, 0xe3, 0x82, 0xad, | 95 0x82, 0xa2, 0xe3, 0x82, 0xb5, 0xe3, 0x82, 0xad, |
96 0xe3, 0x83, 0xa6, 0xe3, 0x83, 0xa1, 0xe3, 0x83, | 96 0xe3, 0x83, 0xa6, 0xe3, 0x83, 0xa1, 0xe3, 0x83, |
97 0x9f, 0xe3, 0x82, 0xb7, 0x20, 0xe3, 0x83, 0xb1, | 97 0x9f, 0xe3, 0x82, 0xb7, 0x20, 0xe3, 0x83, 0xb1, |
98 0xe3, 0x83, 0x92, 0xe3, 0x83, 0xa2, 0xe3, 0x82, | 98 0xe3, 0x83, 0x92, 0xe3, 0x83, 0xa2, 0xe3, 0x82, |
99 0xbb, 0xe3, 0x82, 0xb9, 0xe3, 0x83, 0xb3]; | 99 0xbb, 0xe3, 0x82, 0xb9, 0xe3, 0x83, 0xb3]; |
100 | 100 |
101 TimedTestConfig testConfig_1sec = | 101 TimedTestConfig testConfig_1sec = |
102 new TimedTestConfig(100, 1 * 1000, blocksize: 1000); | 102 new TimedTestConfig(100, 1 * 1000, blocksize: 1000); |
103 | 103 |
104 BenchmarkRunner.runTimed("SE_EN1","string_encoding/decodeUtf8-English1", | 104 BenchmarkRunner.runTimed("SE_EN1","string_encoding/decodeUtf8-English1", |
105 testConfig_1sec, () => | 105 testConfig_1sec, () => SE.UTF8.decode(testEnglishUtf8)); |
106 (new SE.Utf8Decoder(testEnglishUtf8)).decodeRest()); | |
107 | 106 |
108 BenchmarkRunner.runTimed("SE_DA1","string_encoding/decodeUtf8-Danish1", | 107 BenchmarkRunner.runTimed("SE_DA1","string_encoding/decodeUtf8-Danish1", |
109 testConfig_1sec, () => (new SE.Utf8Decoder(testDanishUtf8)).decodeRest()); | 108 testConfig_1sec, () => SE.UTF8.decode(testDanishUtf8)); |
110 | 109 |
111 BenchmarkRunner.runTimed("SE_HE1","string_encoding/decodeUtf8-Hebrew1", | 110 BenchmarkRunner.runTimed("SE_HE1","string_encoding/decodeUtf8-Hebrew1", |
112 testConfig_1sec, () => (new SE.Utf8Decoder(testHebrewUtf8)).decodeRest()); | 111 testConfig_1sec, () => SE.UTF8.decode(testHebrewUtf8)); |
113 | 112 |
114 BenchmarkRunner.runTimed("SE_RU1","string_encoding/decodeUtf8-Russian1", | 113 BenchmarkRunner.runTimed("SE_RU1","string_encoding/decodeUtf8-Russian1", |
115 testConfig_1sec, () => | 114 testConfig_1sec, () => SE.UTF8.decode(testRussianUtf8)); |
116 (new SE.Utf8Decoder(testRussianUtf8)).decodeRest()); | |
117 | 115 |
118 BenchmarkRunner.runTimed("SE_EL1","string_encoding/decodeUtf8-Greek", | 116 BenchmarkRunner.runTimed("SE_EL1","string_encoding/decodeUtf8-Greek", |
119 testConfig_1sec, () => | 117 testConfig_1sec, () => SE.UTF8.decode(testGreekUtf8)); |
120 (new SE.Utf8Decoder(testGreekUtf8)).decodeRest()); | |
121 | 118 |
122 BenchmarkRunner.runTimed("SE_JA1","string_encoding/decodeUtf8-Katakana", | 119 BenchmarkRunner.runTimed("SE_JA1","string_encoding/decodeUtf8-Katakana", |
123 testConfig_1sec, () => | 120 testConfig_1sec, () => SE.UTF8.decode(testKatakanaUtf8)); |
124 (new SE.Utf8Decoder(testKatakanaUtf8)).decodeRest()); | |
125 } | 121 } |
126 | |
OLD | NEW |