|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include <e32test.h> |
|
17 |
|
18 static RTest TheTest(_L("T_FoldPerf")); |
|
19 |
|
20 #define ARRAY_SIZE(ar) (sizeof(ar) / (sizeof(ar[0]))) |
|
21 |
|
22 const TText16 KText16[] = {'1', 'f', 'A', 0x01D5, 'k', '5', 'g', 'U', 'W', 'q', 'a', |
|
23 0x095E, 0x01D5, 'a', 'B', 'c', 'd', 'E', 'F', 0}; |
|
24 //0x095E - DEVANAGARI LETTER FA |
|
25 //decomposed to: 0x092B 0x093C |
|
26 //0x01D5 - LATIN CAPITAL LETTER U WITH DIAERESIS AND MACRON |
|
27 //decomposed to: 0x0075 0x0308 0x0304 |
|
28 |
|
29 _LIT16(KPlainText, "abcdefghijklmnopqrst"); |
|
30 |
|
31 /** |
|
32 @SYMTestCaseID SYSLIB-UNICODE-CT-0108 |
|
33 @SYMTestCaseDesc FindF - performance test |
|
34 @SYMTestPriority High |
|
35 @SYMTestActions FindF - performance test |
|
36 @SYMTestExpectedResults The test must not fail. |
|
37 @SYMPREQ814 Optimise folded string comparisons. |
|
38 */ |
|
39 static void FindF_PerformanceTest() |
|
40 { |
|
41 TheTest.Next(_L("FindF test")); |
|
42 |
|
43 TBufC16<ARRAY_SIZE(KText16) - 1> text(KText16); |
|
44 |
|
45 TBufC16<3> searchStr1(_L16("gUw")); |
|
46 |
|
47 const TText16 searchText2[] = {0x01D5, 'A', 'b', 0}; |
|
48 TBufC16<ARRAY_SIZE(searchText2) - 1> searchStr2(searchText2); |
|
49 |
|
50 const TText16 searchText3[] = {0x0075, 0x0308, 0x0304, 'A', 'b', 0}; |
|
51 TBufC16<ARRAY_SIZE(searchText3) - 1> searchStr3(searchText3); |
|
52 |
|
53 const TText16 searchText4[] = {0x095E, 'd', 'A', 'b', 0}; |
|
54 TBufC16<ARRAY_SIZE(searchText4) - 1> searchStr4(searchText4); |
|
55 |
|
56 const TText16 searchText5[] = {0x095E, 0x0055, 0x0308, 0x0304, 'A', 'b', 'C', 0}; |
|
57 TBufC16<ARRAY_SIZE(searchText5) - 1> searchStr5(searchText5); |
|
58 |
|
59 TBufC16<4> searchStr6(_L16("CDEF")); |
|
60 |
|
61 TUint timeStart = User::TickCount(); |
|
62 for(TInt i=0;i<10000;++i) |
|
63 { |
|
64 TInt res = text.FindF(searchStr1); |
|
65 TheTest(res == 6);//searchStr1 starts at position 6 |
|
66 |
|
67 res = text.FindF(searchStr2); |
|
68 TheTest(res == 12); |
|
69 |
|
70 res = text.FindF(searchStr3); |
|
71 TheTest(res == 12); |
|
72 |
|
73 res = text.FindF(searchStr4); |
|
74 TheTest(res == KErrNotFound); |
|
75 |
|
76 res = text.FindF(searchStr5); |
|
77 TheTest(res == 11); |
|
78 |
|
79 res = text.FindF(searchStr6); |
|
80 TheTest(res == 15); |
|
81 } |
|
82 TUint timeEnd = User::TickCount(); |
|
83 TheTest.Printf(_L("Time = %d ticks\n"), timeEnd - timeStart); |
|
84 } |
|
85 |
|
86 /** |
|
87 @SYMTestCaseID SYSLIB-UNICODE-CT-0109 |
|
88 @SYMTestCaseDesc MatchF - performance test |
|
89 @SYMTestPriority High |
|
90 @SYMTestActions MatchF - performance test |
|
91 @SYMTestExpectedResults The test must not fail. |
|
92 @SYMPREQ814 Optimise folded string comparisons. |
|
93 */ |
|
94 static void MatchF_PerformanceTest() |
|
95 { |
|
96 TheTest.Next(_L("MatchF test")); |
|
97 |
|
98 TBufC16<ARRAY_SIZE(KText16) - 1> text(KText16); |
|
99 |
|
100 TBufC16<11> searchStr1(_L16("*fa??5*W*a*")); |
|
101 |
|
102 const TText16 searchText2[] = {'*', 0x01D5, 'A', '?', 'C', '*', 0}; |
|
103 TBufC16<ARRAY_SIZE(searchText2) - 1> searchStr2(searchText2); |
|
104 |
|
105 const TText16 searchText3[] = {'*', 0x0075, 0x0308, 0x0304, '*', 'e', 'F', 0}; |
|
106 TBufC16<ARRAY_SIZE(searchText3) - 1> searchStr3(searchText3); |
|
107 |
|
108 const TText16 searchText4[] = {'1', '*', 'A', 'b', '*', 0}; |
|
109 TBufC16<ARRAY_SIZE(searchText4) - 1> searchStr4(searchText4); |
|
110 |
|
111 TBufC16<11> searchStr5(_L16("*fa?z5*W*a*")); |
|
112 |
|
113 TBufC16<5> searchStr6(_L16("a?v?T")); |
|
114 |
|
115 TUint timeStart = User::TickCount(); |
|
116 for(TInt i=0;i<10000;++i) |
|
117 { |
|
118 TInt res = text.MatchF(searchStr1); |
|
119 TheTest(res == 1); |
|
120 |
|
121 res = text.MatchF(searchStr2); |
|
122 TheTest(res == 12); |
|
123 |
|
124 res = text.MatchF(searchStr3); |
|
125 TheTest(res == 3); |
|
126 |
|
127 res = text.MatchF(searchStr4); |
|
128 TheTest(res == 0); |
|
129 |
|
130 res = text.MatchF(searchStr5); |
|
131 TheTest(res == KErrNotFound); |
|
132 |
|
133 res = text.MatchF(searchStr6); |
|
134 TheTest(res == KErrNotFound); |
|
135 } |
|
136 TUint timeEnd = User::TickCount(); |
|
137 TheTest.Printf(_L("Time = %d ticks\n"), timeEnd - timeStart); |
|
138 } |
|
139 |
|
140 /** |
|
141 @SYMTestCaseID SYSLIB-UNICODE-CT-0110 |
|
142 @SYMTestCaseDesc CompareF - performance test |
|
143 @SYMTestPriority High |
|
144 @SYMTestActions CompareF - performance test |
|
145 @SYMTestExpectedResults The test must not fail. |
|
146 @SYMPREQ814 Optimise folded string comparisons. |
|
147 */ |
|
148 static void CompareF_PerformanceTest() |
|
149 { |
|
150 TheTest.Next(_L("CompareF test")); |
|
151 |
|
152 TBufC16<ARRAY_SIZE(KText16) - 1> text(KText16); |
|
153 |
|
154 const TText16 text1[] = {'1', 'F', 'A', 0x01D5, 'k', '5', 'G', 'U', 'W', 'Q', 'A', |
|
155 0x095E, 0x01D5, 'a', 'B', 'C', 'd', 'E', 'F', 0}; |
|
156 TBufC16<ARRAY_SIZE(text1) - 1> str1(text1); |
|
157 |
|
158 TBufC16<19> str2(_L16("1234567890123456789")); |
|
159 |
|
160 TBufC16<19> str3(_L16("1fA4G6789r1d34z6789")); |
|
161 |
|
162 TUint timeStart = User::TickCount(); |
|
163 TInt i; |
|
164 for(i=0;i<10000;++i) |
|
165 { |
|
166 TInt res = text.CompareF(str1); |
|
167 TheTest(res == 0); |
|
168 |
|
169 res = text.CompareF(str2); |
|
170 TheTest(res != 0); |
|
171 |
|
172 res = text.CompareF(str3); |
|
173 TheTest(res != 0); |
|
174 } |
|
175 TUint timeEnd = User::TickCount(); |
|
176 TheTest.Printf(_L("1. Time = %d ticks\n"), timeEnd - timeStart); |
|
177 |
|
178 TBufC16<20> str4(_L16("abc3456hijklmnopqrst")); |
|
179 timeStart = User::TickCount(); |
|
180 for(i=0;i<10000;++i) |
|
181 { |
|
182 TInt res = str4.CompareF(KPlainText); |
|
183 TheTest(res != 0); |
|
184 } |
|
185 timeEnd = User::TickCount(); |
|
186 TheTest.Printf(_L("2. Time = %d ticks\n"), timeEnd - timeStart); |
|
187 |
|
188 } |
|
189 |
|
190 /** |
|
191 @SYMTestCaseID SYSLIB-UNICODE-CT-0114 |
|
192 @SYMTestCaseDesc FindF(), CompareF(), MatchF() on plain (no combining characters) text |
|
193 @SYMTestPriority High |
|
194 @SYMTestActions Performance test |
|
195 @SYMTestExpectedResults The test must not fail. |
|
196 @SYMPREQ814 Optimise folded string comparisons. |
|
197 */ |
|
198 static void PlainTextPerformanceTest() |
|
199 { |
|
200 TheTest.Next(_L("Plain text - performance test")); |
|
201 |
|
202 TInt res; |
|
203 TInt i; |
|
204 |
|
205 TBufC16<20> str1(_L16("abcdefghijklmnopqrst")); |
|
206 TBufC16<20> str2(_L16("abcDefghIjklmNOpqrsT")); |
|
207 TBufC16<20> str3(_L16("abcDefghIjKlmNOp2rsT")); |
|
208 |
|
209 TUint timeStart = User::TickCount(); |
|
210 for(i=0;i<10000;++i) |
|
211 { |
|
212 res = KPlainText().CompareF(str1); |
|
213 TheTest(res == 0); |
|
214 res = KPlainText().CompareF(str2); |
|
215 TheTest(res == 0); |
|
216 res = KPlainText().CompareF(str3); |
|
217 TheTest(res != 0); |
|
218 } |
|
219 TUint timeEnd = User::TickCount(); |
|
220 TheTest.Printf(_L("CompareF() Time = %d ticks\n"), timeEnd - timeStart); |
|
221 |
|
222 TBufC16<20> str4(_L16("gHiJk")); |
|
223 TBufC16<20> str5(_L16("Opqr")); |
|
224 TBufC16<20> str6(_L16("2rsT")); |
|
225 |
|
226 timeStart = User::TickCount(); |
|
227 for(i=0;i<10000;++i) |
|
228 { |
|
229 res = KPlainText().FindF(str4); |
|
230 TheTest(res == 6); |
|
231 res = KPlainText().FindF(str5); |
|
232 TheTest(res == 14); |
|
233 res = KPlainText().FindF(str6); |
|
234 TheTest(res == KErrNotFound); |
|
235 } |
|
236 timeEnd = User::TickCount(); |
|
237 TheTest.Printf(_L("FindF() Time = %d ticks\n"), timeEnd - timeStart); |
|
238 |
|
239 TBufC16<20> str7(_L16("*gHiJk*op??sT")); |
|
240 TBufC16<20> str8(_L16("aBC*rst")); |
|
241 TBufC16<20> str9(_L16("ab?D*2rsT")); |
|
242 |
|
243 timeStart = User::TickCount(); |
|
244 for(i=0;i<10000;++i) |
|
245 { |
|
246 res = KPlainText().MatchF(str7); |
|
247 TheTest(res == 6); |
|
248 res = KPlainText().MatchF(str8); |
|
249 TheTest(res == 0); |
|
250 res = KPlainText().MatchF(str9); |
|
251 TheTest(res == KErrNotFound); |
|
252 } |
|
253 timeEnd = User::TickCount(); |
|
254 TheTest.Printf(_L("MatchF() Time = %d ticks\n"), timeEnd - timeStart); |
|
255 |
|
256 TBufC16<21> str10(_L16("abcdefghijklmnopqrst")); |
|
257 TBufC16<20> str11(_L16("*xyz*")); |
|
258 TBufC16<20> str12(_L16("xyz")); |
|
259 |
|
260 timeStart = User::TickCount(); |
|
261 for(i=0;i<10000;++i) |
|
262 { |
|
263 res = str10.FindF(str12); |
|
264 TheTest(res == KErrNotFound); |
|
265 } |
|
266 timeEnd = User::TickCount(); |
|
267 TheTest.Printf(_L("Nonmatching string. FindF() Time = %d ticks\n"), timeEnd - timeStart); |
|
268 |
|
269 timeStart = User::TickCount(); |
|
270 for(i=0;i<10000;++i) |
|
271 { |
|
272 res = str10.MatchF(str11); |
|
273 TheTest(res == KErrNotFound); |
|
274 res = str10.MatchF(str12); |
|
275 TheTest(res == KErrNotFound); |
|
276 } |
|
277 timeEnd = User::TickCount(); |
|
278 TheTest.Printf(_L("Nonmatching string. MatchF() Time = %d ticks\n"), timeEnd - timeStart); |
|
279 } |
|
280 |
|
281 static void RunComparison_PerformanceTest(TInt aNumberOfTimes, TDesC& aOriginalText, TDesC& aToCompareText, TBool aCase, TInt aValue = 0) |
|
282 { |
|
283 TUint timeStart; |
|
284 TUint timeEnd; |
|
285 TInt res = 0; |
|
286 TInt i; |
|
287 |
|
288 // CompareF() case... |
|
289 timeStart = User::TickCount(); |
|
290 |
|
291 for(i=0; i<aNumberOfTimes; ++i) |
|
292 { |
|
293 res = aOriginalText.CompareF(aToCompareText); |
|
294 |
|
295 if(aCase) |
|
296 TheTest(res == 0); |
|
297 else |
|
298 TheTest(res != 0); |
|
299 } |
|
300 |
|
301 timeEnd = User::TickCount(); |
|
302 |
|
303 TheTest.Printf(_L("Time to run (x%d) 16-bit CompareF() = %d ticks\n"), aNumberOfTimes, timeEnd - timeStart); |
|
304 |
|
305 // Check return value |
|
306 |
|
307 TheTest(res == aValue); |
|
308 |
|
309 // Compare() case... |
|
310 timeStart = User::TickCount(); |
|
311 |
|
312 for(i=0; i<aNumberOfTimes; ++i) |
|
313 { |
|
314 res = aOriginalText.Compare(aToCompareText); |
|
315 |
|
316 if(aCase) |
|
317 TheTest(res == 0); |
|
318 else |
|
319 TheTest(res != 0); |
|
320 } |
|
321 |
|
322 timeEnd = User::TickCount(); |
|
323 |
|
324 TheTest.Printf(_L("Time to run (x%d) 16-bit Compare() = %d ticks\n"), aNumberOfTimes, timeEnd - timeStart); |
|
325 } |
|
326 |
|
327 static void RunComparison_PerformanceTest(TInt aNumberOfTimes, TDesC8& aOriginalText, TDesC8& aToCompareText, TBool aCase, TInt aValue = 0) |
|
328 { |
|
329 TUint timeStart; |
|
330 TUint timeEnd; |
|
331 TInt res = 0; |
|
332 TInt i; |
|
333 |
|
334 // CompareF() case... |
|
335 timeStart = User::TickCount(); |
|
336 |
|
337 for(i=0; i<aNumberOfTimes; ++i) |
|
338 { |
|
339 res = aOriginalText.CompareF(aToCompareText); |
|
340 |
|
341 if(aCase) |
|
342 TheTest(res == 0); |
|
343 else |
|
344 TheTest(res != 0); |
|
345 } |
|
346 |
|
347 timeEnd = User::TickCount(); |
|
348 |
|
349 TheTest.Printf(_L("Time to run (x%d) 8-bit CompareF() = %d ticks\n"), aNumberOfTimes, timeEnd - timeStart); |
|
350 |
|
351 // Check return value |
|
352 |
|
353 TheTest(res == aValue); |
|
354 |
|
355 // Compare() case... |
|
356 timeStart = User::TickCount(); |
|
357 |
|
358 for(i=0; i<aNumberOfTimes; ++i) |
|
359 { |
|
360 res = aOriginalText.Compare(aToCompareText); |
|
361 |
|
362 if(aCase) |
|
363 TheTest(res == 0); |
|
364 else |
|
365 TheTest(res != 0); |
|
366 } |
|
367 |
|
368 timeEnd = User::TickCount(); |
|
369 |
|
370 TheTest.Printf(_L("Time to run (x%d) 8-bit Compare() = %d ticks\n"), aNumberOfTimes, timeEnd - timeStart); |
|
371 } |
|
372 |
|
373 static void CompareVsCompareF_PerformanceTest() |
|
374 { |
|
375 TheTest.Next(_L("Compare verses CompareF test")); |
|
376 |
|
377 // Declare variables... |
|
378 |
|
379 TInt numberOfTimes = 100000; |
|
380 |
|
381 const TText16 smallUnicodeText16[] = {0x01D5, 0x0308, 0x0304, 0x095E, 0x01D5, 0}; // 5 Characters |
|
382 |
|
383 const TText16 largeUnicodeText16[] = {0x01D5, 0x0308, 0x0304, 0x095E, 0x01D5, |
|
384 0x01D5, 0x0308, 0x0304, 0x095E, 0x01D5, |
|
385 0x01D5, 0x0308, 0x0304, 0x095E, 0x01D5, |
|
386 0x01D5, 0x0308, 0x0304, 0x095E, 0x01D5, |
|
387 0x01D5, 0x0308, 0x0304, 0x095E, 0x01D5, |
|
388 0x01D5, 0x0308, 0x0304, 0x095E, 0x01D5, |
|
389 0x01D5, 0x0308, 0x0304, 0x095E, 0x01D5, |
|
390 0x01D5, 0x0308, 0x0304, 0x095E, 0x01D5, |
|
391 0x01D5, 0x0308, 0x0304, 0x095E, 0x01D5, |
|
392 0x01D5, 0x0308, 0x0304, 0x095E, 0x01D5, 0}; // 50 Characters |
|
393 |
|
394 const TText16 smallErrUnicodeTextLast16[] = {0x01D5, 0x0308, 0x0304, 0x095E, 'X', 0}; // 5 Characters |
|
395 |
|
396 const TText16 smallErrUnicodeTextFirst16[] = {'X', 0x0308, 0x0304, 0x095E, 0x01D5, 0}; // 5 Characters |
|
397 |
|
398 const TText16 largeErrUnicodeTextLast16[] = {0x01D5, 0x0308, 0x0304, 0x095E, 0x01D5, |
|
399 0x01D5, 0x0308, 0x0304, 0x095E, 0x01D5, |
|
400 0x01D5, 0x0308, 0x0304, 0x095E, 0x01D5, |
|
401 0x01D5, 0x0308, 0x0304, 0x095E, 0x01D5, |
|
402 0x01D5, 0x0308, 0x0304, 0x095E, 0x01D5, |
|
403 0x01D5, 0x0308, 0x0304, 0x095E, 0x01D5, |
|
404 0x01D5, 0x0308, 0x0304, 0x095E, 0x01D5, |
|
405 0x01D5, 0x0308, 0x0304, 0x095E, 0x01D5, |
|
406 0x01D5, 0x0308, 0x0304, 0x095E, 0x01D5, |
|
407 0x01D5, 0x0308, 0x0304, 0x095E, 'X', 0}; // 50 Characters |
|
408 |
|
409 const TText16 largeErrUnicodeTextFirst16[] = {'X', 0x0308, 0x0304, 0x095E, 0x01D5, |
|
410 0x01D5, 0x0308, 0x0304, 0x095E, 0x01D5, |
|
411 0x01D5, 0x0308, 0x0304, 0x095E, 0x01D5, |
|
412 0x01D5, 0x0308, 0x0304, 0x095E, 0x01D5, |
|
413 0x01D5, 0x0308, 0x0304, 0x095E, 0x01D5, |
|
414 0x01D5, 0x0308, 0x0304, 0x095E, 0x01D5, |
|
415 0x01D5, 0x0308, 0x0304, 0x095E, 0x01D5, |
|
416 0x01D5, 0x0308, 0x0304, 0x095E, 0x01D5, |
|
417 0x01D5, 0x0308, 0x0304, 0x095E, 0x01D5, |
|
418 0x01D5, 0x0308, 0x0304, 0x095E, 0x01D5, 0}; // 50 Characters |
|
419 |
|
420 const TText16 smallMixedText16[] = {'A', 'B', 'C', 0x095E, 0x01D5, 0}; // 5 Characters |
|
421 |
|
422 const TText16 largeMixedText16[] = {'A', 'B', 'C', 0x095E, 0x01D5, |
|
423 'F', 'G', 'H', 'I', 'J', |
|
424 'K', 'L', 'M', 'N', 'O', |
|
425 'P', 'Q', 'R', 'S', 'T', |
|
426 'U', 'V', 'W', 'X', 'Y', |
|
427 'Z', '1', '2', '3', '4', |
|
428 '5', '6', '7', '8', '9', |
|
429 'a', 'b', 'c', 'd', 'e', |
|
430 'f', 'g', 'h', 'i', 'j', |
|
431 'k', 'l', 'm', 0x095E, 0x01D5, 0}; // 50 Characters |
|
432 |
|
433 const TText16 smallErrMixedTextLast16[] = {'A', 'B', 'C', 0x095E, 0x0304, 0}; // 5 Characters |
|
434 |
|
435 const TText16 smallErrMixedTextFirst16[] = {0x0304, 'B', 'C', 0x095E, 0x01D5, 0}; // 5 Characters |
|
436 |
|
437 const TText16 largeErrMixedTextLast16[] = {'A', 'B', 'C', 0x095E, 0x01D5, |
|
438 'F', 'G', 'H', 'I', 'J', |
|
439 'K', 'L', 'M', 'N', 'O', |
|
440 'P', 'Q', 'R', 'S', 'T', |
|
441 'U', 'V', 'W', 'X', 'Y', |
|
442 'Z', '1', '2', '3', '4', |
|
443 '5', '6', '7', '8', '9', |
|
444 'a', 'b', 'c', 'd', 'e', |
|
445 'f', 'g', 'h', 'i', 'j', |
|
446 'k', 'l', 'm', 0x095E, 0x0304, 0}; // 50 Characters |
|
447 |
|
448 const TText16 largeErrMixedTextFirst16[] = {0x0304, 'B', 'C', 0x095E, 0x01D5, |
|
449 'F', 'G', 'H', 'I', 'J', |
|
450 'K', 'L', 'M', 'N', 'O', |
|
451 'P', 'Q', 'R', 'S', 'T', |
|
452 'U', 'V', 'W', 'X', 'Y', |
|
453 'Z', '1', '2', '3', '4', |
|
454 '5', '6', '7', '8', '9', |
|
455 'a', 'b', 'c', 'd', 'e', |
|
456 'f', 'g', 'h', 'i', 'j', |
|
457 'k', 'l', 'm', 0x095E, 0x01D5, 0}; // 50 Characters |
|
458 |
|
459 // (16-bit) Ascii Set of variables |
|
460 |
|
461 TBufC16<50> oriAsciiLargeText(_L("ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789abcdefghijklmno")); |
|
462 TBufC16<5> oriAsciiSmallText(_L("ABCDE")); |
|
463 |
|
464 TBufC16<50> matchAsciiLargeText(_L("ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789abcdefghijklmno")); |
|
465 TBufC16<5> matchAsciiSmallText(_L("ABCDE")); |
|
466 |
|
467 TBufC16<50> nonMatchAsciiLargeTextLast(_L("ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789abcdefghijklmnX")); |
|
468 TBufC16<50> nonMatchAsciiLargeTextFirst(_L("XBCDEFGHIJKLMNOPQRSTUVWXYZ123456789abcdefghijklmno")); |
|
469 |
|
470 TBufC16<5> nonMatchAsciiSmallTextLast(_L("ABCDX")); |
|
471 TBufC16<5> nonMatchAsciiSmallTextFirst(_L("XBCDE")); |
|
472 |
|
473 // (8-bit) Ascii Set of variables |
|
474 |
|
475 TBufC8<50> oriAsciiLargeText8(_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789abcdefghijklmno")); |
|
476 TBufC8<5> oriAsciiSmallText8(_L8("ABCDE")); |
|
477 |
|
478 TBufC8<50> matchAsciiLargeText8(_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789abcdefghijklmno")); |
|
479 TBufC8<5> matchAsciiSmallText8(_L8("ABCDE")); |
|
480 |
|
481 TBufC8<50> nonMatchAsciiLargeTextLast8(_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789abcdefghijklmnX")); |
|
482 TBufC8<50> nonMatchAsciiLargeTextFirst8(_L8("XBCDEFGHIJKLMNOPQRSTUVWXYZ123456789abcdefghijklmno")); |
|
483 |
|
484 TBufC8<5> nonMatchAsciiSmallTextLast8(_L8("ABCDX")); |
|
485 TBufC8<5> nonMatchAsciiSmallTextFirst8(_L8("XBCDE")); |
|
486 |
|
487 // (16-bit) Unicode Set of variables |
|
488 |
|
489 TBufC16<ARRAY_SIZE(largeUnicodeText16) - 1> oriUnicodeLargeText(largeUnicodeText16); |
|
490 TBufC16<ARRAY_SIZE(smallUnicodeText16) - 1> oriUnicodeSmallText(smallUnicodeText16); |
|
491 |
|
492 TBufC16<ARRAY_SIZE(largeUnicodeText16) - 1> matchUnicodeLargeText(largeUnicodeText16); |
|
493 TBufC16<ARRAY_SIZE(smallUnicodeText16) - 1> matchUnicodeSmallText(smallUnicodeText16); |
|
494 |
|
495 TBufC16<ARRAY_SIZE(largeErrUnicodeTextLast16) - 1> nonMatchUnicodeLargeTextLast(largeErrUnicodeTextLast16); |
|
496 TBufC16<ARRAY_SIZE(largeErrUnicodeTextFirst16) - 1> nonMatchUnicodeLargeTextFirst(largeErrUnicodeTextFirst16); |
|
497 |
|
498 TBufC16<ARRAY_SIZE(smallErrUnicodeTextLast16) - 1> nonMatchUnicodeSmallTextLast(smallErrUnicodeTextLast16); |
|
499 TBufC16<ARRAY_SIZE(smallErrUnicodeTextFirst16) - 1> nonMatchUnicodeSmallTextFirst(smallErrUnicodeTextFirst16); |
|
500 |
|
501 // (16-bit) Unicode/Ascii Set of variables |
|
502 |
|
503 TBufC16<ARRAY_SIZE(largeMixedText16) - 1> oriMixedLargeText(largeMixedText16); |
|
504 TBufC16<ARRAY_SIZE(smallMixedText16) - 1> oriMixedSmallText(smallMixedText16); |
|
505 |
|
506 TBufC16<ARRAY_SIZE(largeMixedText16) - 1> matchMixedLargeText(largeMixedText16); |
|
507 TBufC16<ARRAY_SIZE(smallMixedText16) - 1> matchMixedSmallText(smallMixedText16); |
|
508 |
|
509 TBufC16<ARRAY_SIZE(largeErrMixedTextLast16) - 1> nonMatchMixedLargeTextLast(largeErrMixedTextLast16); |
|
510 TBufC16<ARRAY_SIZE(largeErrMixedTextFirst16) - 1> nonMatchMixedLargeTextFirst(largeErrMixedTextFirst16); |
|
511 |
|
512 TBufC16<ARRAY_SIZE(smallErrMixedTextLast16) - 1> nonMatchMixedSmallTextLast(smallErrMixedTextLast16); |
|
513 TBufC16<ARRAY_SIZE(smallErrMixedTextFirst16) - 1> nonMatchMixedSmallTextFirst(smallErrMixedTextFirst16); |
|
514 |
|
515 // Run performance tests... |
|
516 |
|
517 TheTest.Printf(_L("\n====== (8-bit) Ascii Performance tests ======")); |
|
518 |
|
519 // Matching (8-bit) Ascii |
|
520 |
|
521 TheTest.Printf(_L("\nComparing Performance Times For: \nMatching Large Ascii Text\n")); |
|
522 RunComparison_PerformanceTest(numberOfTimes, oriAsciiLargeText8, matchAsciiLargeText8, ETrue); |
|
523 |
|
524 TheTest.Printf(_L("\nComparing Performance Times For: \nMatching Small Ascii Text\n")); |
|
525 RunComparison_PerformanceTest(numberOfTimes, oriAsciiSmallText8, matchAsciiSmallText8, ETrue); |
|
526 |
|
527 // Non Matching (8-bit) Ascii |
|
528 |
|
529 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Large Ascii Text / Last Char Diff / Large Vs Large\n")); |
|
530 RunComparison_PerformanceTest(numberOfTimes, oriAsciiLargeText8, nonMatchAsciiLargeTextLast8, EFalse, -9); |
|
531 |
|
532 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Large Ascii Text / First Char Diff / Large Vs Large\n")); |
|
533 RunComparison_PerformanceTest(numberOfTimes, oriAsciiLargeText8, nonMatchAsciiLargeTextFirst8, EFalse, -23); |
|
534 |
|
535 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Small Ascii Text / Last Char Diff / Small Vs Small\n")); |
|
536 RunComparison_PerformanceTest(numberOfTimes, oriAsciiSmallText8, nonMatchAsciiSmallTextLast8, EFalse, -19); |
|
537 |
|
538 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Small Ascii Text / First Char Diff / Small Vs Small\n")); |
|
539 RunComparison_PerformanceTest(numberOfTimes, oriAsciiSmallText8, nonMatchAsciiSmallTextFirst8, EFalse, -23); |
|
540 |
|
541 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Large Ascii Text / Last Char Diff / Large Vs Small\n")); |
|
542 RunComparison_PerformanceTest(numberOfTimes, oriAsciiLargeText8, nonMatchAsciiSmallTextLast8, EFalse, -19); |
|
543 |
|
544 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Large Ascii Text / First Char Diff / Large Vs Small\n")); |
|
545 RunComparison_PerformanceTest(numberOfTimes, oriAsciiLargeText8, nonMatchAsciiSmallTextFirst8, EFalse, -23); |
|
546 |
|
547 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Small Ascii Text / Last Char Diff / Small Vs Large\n")); |
|
548 RunComparison_PerformanceTest(numberOfTimes, oriAsciiSmallText8, nonMatchAsciiLargeTextLast8, EFalse, -45); |
|
549 |
|
550 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Small Ascii Text / First Char Diff / Small Vs Large\n")); |
|
551 RunComparison_PerformanceTest(numberOfTimes, oriAsciiSmallText8, nonMatchAsciiLargeTextFirst8, EFalse, -23); |
|
552 |
|
553 // Mismatching length (8-bit) Ascii |
|
554 |
|
555 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Small Ascii Text / Length Mismatch / Small Vs Large\n")); |
|
556 RunComparison_PerformanceTest(numberOfTimes, oriAsciiSmallText8, oriAsciiLargeText8, EFalse, -45); |
|
557 |
|
558 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Large Ascii Text / Length Mismatch / Large Vs Small\n")); |
|
559 RunComparison_PerformanceTest(numberOfTimes, oriAsciiLargeText8, oriAsciiSmallText8, EFalse, 45); |
|
560 |
|
561 TheTest.Printf(_L("\n====== (16-bit) Ascii Performance tests ======")); |
|
562 |
|
563 // Matching (16-bit) Ascii |
|
564 |
|
565 TheTest.Printf(_L("\nComparing Performance Times For: \nMatching Large Ascii Text\n")); |
|
566 RunComparison_PerformanceTest(numberOfTimes, oriAsciiLargeText, matchAsciiLargeText, ETrue); |
|
567 |
|
568 TheTest.Printf(_L("\nComparing Performance Times For: \nMatching Small Ascii Text\n")); |
|
569 RunComparison_PerformanceTest(numberOfTimes, oriAsciiSmallText, matchAsciiSmallText, ETrue); |
|
570 |
|
571 // Non Matching (16-bit) Ascii |
|
572 |
|
573 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Large Ascii Text / Last Char Diff / Large Vs Large\n")); |
|
574 RunComparison_PerformanceTest(numberOfTimes, oriAsciiLargeText, nonMatchAsciiLargeTextLast, EFalse, -9); |
|
575 |
|
576 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Large Ascii Text / First Char Diff / Large Vs Large\n")); |
|
577 RunComparison_PerformanceTest(numberOfTimes, oriAsciiLargeText, nonMatchAsciiLargeTextFirst, EFalse, -23); |
|
578 |
|
579 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Small Ascii Text / Last Char Diff / Small Vs Small\n")); |
|
580 RunComparison_PerformanceTest(numberOfTimes, oriAsciiSmallText, nonMatchAsciiSmallTextLast, EFalse, -19); |
|
581 |
|
582 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Small Ascii Text / First Char Diff / Small Vs Small\n")); |
|
583 RunComparison_PerformanceTest(numberOfTimes, oriAsciiSmallText, nonMatchAsciiSmallTextFirst, EFalse, -23); |
|
584 |
|
585 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Large Ascii Text / Last Char Diff / Large Vs Small\n")); |
|
586 RunComparison_PerformanceTest(numberOfTimes, oriAsciiLargeText, nonMatchAsciiSmallTextLast, EFalse, -19); |
|
587 |
|
588 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Large Ascii Text / First Char Diff / Large Vs Small\n")); |
|
589 RunComparison_PerformanceTest(numberOfTimes, oriAsciiLargeText, nonMatchAsciiSmallTextFirst, EFalse, -23); |
|
590 |
|
591 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Small Ascii Text / Last Char Diff / Small Vs Large\n")); |
|
592 RunComparison_PerformanceTest(numberOfTimes, oriAsciiSmallText, nonMatchAsciiLargeTextLast, EFalse, -1); |
|
593 |
|
594 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Small Ascii Text / First Char Diff / Small Vs Large\n")); |
|
595 RunComparison_PerformanceTest(numberOfTimes, oriAsciiSmallText, nonMatchAsciiLargeTextFirst, EFalse, -23); |
|
596 |
|
597 // Mismatching length (16-bit) Ascii |
|
598 |
|
599 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Small Ascii Text / Length Mismatch / Small Vs Large\n")); |
|
600 RunComparison_PerformanceTest(numberOfTimes, oriAsciiSmallText, oriAsciiLargeText, EFalse, -1); |
|
601 |
|
602 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Large Ascii Text / Length Mismatch / Large Vs Small\n")); |
|
603 RunComparison_PerformanceTest(numberOfTimes, oriAsciiLargeText, oriAsciiSmallText, EFalse, 1); |
|
604 |
|
605 TheTest.Printf(_L("\n====== (16-bit) Unicode Performance tests ======")); |
|
606 |
|
607 // Matching (16-bit) Unicode |
|
608 |
|
609 TheTest.Printf(_L("\nComparing Performance Times For: \nMatching Large Unicode Text\n")); |
|
610 RunComparison_PerformanceTest(numberOfTimes, oriUnicodeLargeText, matchUnicodeLargeText, ETrue); |
|
611 |
|
612 TheTest.Printf(_L("\nComparing Performance Times For: \nMatching Small Unicode Text\n")); |
|
613 RunComparison_PerformanceTest(numberOfTimes, oriUnicodeSmallText, matchUnicodeSmallText, ETrue); |
|
614 |
|
615 // Non Matching (16-bit) Unicode |
|
616 |
|
617 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Large Unicode Text / Last Char Diff / Large Vs Large\n")); |
|
618 RunComparison_PerformanceTest(numberOfTimes, oriUnicodeLargeText, nonMatchUnicodeLargeTextLast, EFalse, -3); |
|
619 |
|
620 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Large Unicode Text / First Char Diff / Large Vs Large\n")); |
|
621 RunComparison_PerformanceTest(numberOfTimes, oriUnicodeLargeText, nonMatchUnicodeLargeTextFirst, EFalse, -3); |
|
622 |
|
623 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Small Unicode Text / Last Char Diff / Small Vs Small\n")); |
|
624 RunComparison_PerformanceTest(numberOfTimes, oriUnicodeSmallText, nonMatchUnicodeSmallTextLast, EFalse, -3); |
|
625 |
|
626 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Small Unicode Text / First Char Diff / Small Vs Small\n")); |
|
627 RunComparison_PerformanceTest(numberOfTimes, oriUnicodeSmallText, nonMatchUnicodeSmallTextFirst, EFalse, -3); |
|
628 |
|
629 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Large Unicode Text / Last Char Diff / Large Vs Small\n")); |
|
630 RunComparison_PerformanceTest(numberOfTimes, oriUnicodeLargeText, nonMatchUnicodeSmallTextLast, EFalse, -3); |
|
631 |
|
632 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Large Unicode Text / First Char Diff / Large Vs Small\n")); |
|
633 RunComparison_PerformanceTest(numberOfTimes, oriUnicodeLargeText, nonMatchUnicodeSmallTextFirst, EFalse, -3); |
|
634 |
|
635 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Small Unicode Text / Last Char Diff / Small Vs Large\n")); |
|
636 RunComparison_PerformanceTest(numberOfTimes, oriUnicodeSmallText, nonMatchUnicodeLargeTextLast, EFalse, -1); |
|
637 |
|
638 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Small Unicode Text / First Char Diff / Small Vs Large\n")); |
|
639 RunComparison_PerformanceTest(numberOfTimes, oriUnicodeSmallText, nonMatchUnicodeLargeTextFirst, EFalse, -3); |
|
640 |
|
641 // Mismatching length (16-bit) Unicode |
|
642 |
|
643 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Small Unicode Text / Length Mismatch / Small Vs Large\n")); |
|
644 RunComparison_PerformanceTest(numberOfTimes, oriUnicodeSmallText, oriUnicodeLargeText, EFalse, -1); |
|
645 |
|
646 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Large Unicode Text / Length Mismatch / Large Vs Small\n")); |
|
647 RunComparison_PerformanceTest(numberOfTimes, oriUnicodeLargeText, oriUnicodeSmallText, EFalse, 1); |
|
648 |
|
649 TheTest.Printf(_L("\n====== (16-bit) Mixed Performance tests ======")); |
|
650 |
|
651 // Matching (16-bit) Mixed |
|
652 |
|
653 TheTest.Printf(_L("\nComparing Performance Times For: \nMatching Large Mixed Text\n")); |
|
654 RunComparison_PerformanceTest(numberOfTimes, oriMixedLargeText, matchMixedLargeText, ETrue); |
|
655 |
|
656 TheTest.Printf(_L("\nComparing Performance Times For: \nMatching Small Mixed Text\n")); |
|
657 RunComparison_PerformanceTest(numberOfTimes, oriMixedSmallText, matchMixedSmallText, ETrue); |
|
658 |
|
659 // Non Matching (16-bit) Mixed |
|
660 |
|
661 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Large Mixed Text / Last Char Diff / Large Vs Large\n")); |
|
662 RunComparison_PerformanceTest(numberOfTimes, oriMixedLargeText, nonMatchMixedLargeTextLast, EFalse, -655); |
|
663 |
|
664 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Large Mixed Text / First Char Diff / Large Vs Large\n")); |
|
665 RunComparison_PerformanceTest(numberOfTimes, oriMixedLargeText, nonMatchMixedLargeTextFirst, EFalse, -675); |
|
666 |
|
667 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Small Mixed Text / Last Char Diff / Small Vs Small\n")); |
|
668 RunComparison_PerformanceTest(numberOfTimes, oriMixedSmallText, nonMatchMixedSmallTextLast, EFalse, -655); |
|
669 |
|
670 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Small Mixed Text / First Char Diff / Small Vs Small\n")); |
|
671 RunComparison_PerformanceTest(numberOfTimes, oriMixedSmallText, nonMatchMixedSmallTextFirst, EFalse, -675); |
|
672 |
|
673 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Large Mixed Text / Last Char Diff / Large Vs Small\n")); |
|
674 RunComparison_PerformanceTest(numberOfTimes, oriMixedLargeText, nonMatchMixedSmallTextLast, EFalse, -655); |
|
675 |
|
676 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Large Mixed Text / First Char Diff / Large Vs Small\n")); |
|
677 RunComparison_PerformanceTest(numberOfTimes, oriMixedLargeText, nonMatchMixedSmallTextFirst, EFalse, -675); |
|
678 |
|
679 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Small Mixed Text / Last Char Diff / Small Vs Large\n")); |
|
680 RunComparison_PerformanceTest(numberOfTimes, oriMixedSmallText, nonMatchMixedLargeTextLast, EFalse, -1); |
|
681 |
|
682 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Small Mixed Text / First Char Diff / Small Vs Large\n")); |
|
683 RunComparison_PerformanceTest(numberOfTimes, oriMixedSmallText, nonMatchMixedLargeTextFirst, EFalse, -675); |
|
684 |
|
685 // Mismatching length (16-bit) Mixed |
|
686 |
|
687 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Small Mixed Text / Length Mismatch / Small Vs Large\n")); |
|
688 RunComparison_PerformanceTest(numberOfTimes, oriMixedSmallText, oriMixedLargeText, EFalse, -1); |
|
689 |
|
690 TheTest.Printf(_L("\nComparing Performance Times For: \nNON Matching Large Mixed Text / Length Mismatch / Large Vs Small\n")); |
|
691 RunComparison_PerformanceTest(numberOfTimes, oriMixedLargeText, oriMixedSmallText, EFalse, 1); |
|
692 } |
|
693 |
|
694 |
|
695 |
|
696 TInt E32Main() |
|
697 { |
|
698 TheTest.Title(); |
|
699 |
|
700 TheTest.Start(_L("Folding - performance tests")); |
|
701 |
|
702 ::FindF_PerformanceTest(); |
|
703 ::MatchF_PerformanceTest(); |
|
704 ::CompareF_PerformanceTest(); |
|
705 ::PlainTextPerformanceTest(); |
|
706 ::CompareVsCompareF_PerformanceTest(); |
|
707 |
|
708 TheTest.End(); |
|
709 TheTest.Close(); |
|
710 |
|
711 return KErrNone; |
|
712 } |