2 # *******************************************************************************
3 # * Copyright (C) 2002-2004, International Business Machines Corporation and *
4 # * others. All Rights Reserved. *
5 # *******************************************************************************
8 # ICU and Windows Collation performance test script
9 # Used in conjunction with the collperf test program.
10 # This script defines the locales and data files to be tested,
11 # runs the collperf program, and formats and prints the results.
13 # 7 June 2001 Andy Heninger
15 # ICU4J and Java Collator performance test script
16 # 2002-09-25 modified by Richard Liang
18 print "To run this performance test\n";
19 print "cd to the ICU4J root directory, one directory below src\n";
20 print "run perl src\\com\\ibm\\icu\\dev\\test\\perf\\collationperf.pl\n";
23 # Map defines the set of data files to run in each locale
26 "en_US", "TestNames_Latin.txt",
27 "da_DK", "TestNames_Latin.txt",
28 "de_DE", "TestNames_Latin.txt",
29 "de__PHONEBOOK", "TestNames_Latin.txt",
30 "fr_FR", "TestNames_Latin.txt",
31 "ja_JP", "TestNames_Latin.txt TestNames_Japanese_h.txt TestNames_Japanese_k.txt TestNames_Asian.txt",
32 "zh_CN", "TestNames_Latin.txt TestNames_Chinese.txt",
33 "zh_TW", "TestNames_Latin.txt TestNames_Chinese.txt",
34 "zh__PINYIN", "TestNames_Latin.txt TestNames_Chinese.txt",
35 "ru_RU", "TestNames_Latin.txt TestNames_Russian.txt",
36 "th", "TestNames_Latin.txt TestNames_Thai.txt",
37 "ko_KR", "TestNames_Latin.txt TestNames_Korean.txt",
42 # Outer loop runs through the locales to test
43 # (Edit this list dirctly to make changes)
61 # Inner loop runs over the set of data files specified for each locale.
62 # (Edit the %datafiles initialization, above, to make changes.
64 $ff = $dataFiles{$locale};
65 @ff = split(/[\s]+/, $ff);
69 # Run ICU Test for this (locale, data file) pair.
71 $iStrCol = `java -classpath classes com.ibm.icu.dev.test.perf.CollationPerformanceTest -terse -file src/com/ibm/icu/dev/test/perf/data/collation/$data -locale $locale -loop 1000 -binsearch`;
72 $iStrCol =~s/[,\s]*//g; # whack off the leading " ," in the returned result.
73 doKeyTimes("java -classpath classes com.ibm.icu.dev.test.perf.CollationPerformanceTest -terse -file src/com/ibm/icu/dev/test/perf/data/collation/$data -locale $locale -loop 1000 -keygen",
78 # Run Windows test for this (locale, data file) pair. Only do if
79 # we are not on Windows 98/ME and we hava a windows langID
82 $wStrCol = $wKeyGen = $wKeyLen = 0;
83 $wStrCol = `java -classpath classes com.ibm.icu.dev.test.perf.CollationPerformanceTest -terse -file src/com/ibm/icu/dev/test/perf/data/collation/$data -locale $locale -loop 1000 -binsearch -java`;
84 $wStrCol =~s/[,\s]*//g; # whack off the leading " ," in the returned result.
85 doKeyTimes("java -classpath classes com.ibm.icu.dev.test.perf.CollationPerformanceTest -terse -file src/com/ibm/icu/dev/test/perf/data/collation/$data -locale $locale -loop 1000 -keygen -java",
88 $collDiff = $keyGenDiff = $keyLenDiff = 0;
90 $collDiff = (($wStrCol - $iStrCol) / $iStrCol) * 100;
91 $keyGenDiff = (($wKeyGen - $iKeyGen) / $iKeyGen) * 100;
92 $keyLenDiff = (($wKeyLen - $iKeyLen) / $iKeyLen) * 100;
96 # Write the line of results for this (locale, data file).
103 # doKeyGenTimes($Command_to_run, $time, $key_length)
104 # Do a key-generation test and return the time and key length/char values.
106 sub doKeyTimes($$$) {
108 local($x) = `$_[0]`; # execute the collperf command.
109 ($_[1], $_[2]) = split(/\,/, $x); # collperf returns "time, keylength" string.
118 -------- ICU -------- ------ JAVA ------- (JAVA - ICU)/ICU
119 Locale Data file strcoll keygen keylen strcoll keygen keylen coll keygen keylen
120 ------------------------------------------------------------------------------------------------------------
124 @<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<| @###### @#### @#.## |@##### @##### @#.## | @###% @###% @###%
125 $locale, $data, $iStrCol, $iKeyGen, $iKeyLen, $wStrCol, $wKeyGen, $wKeyLen, $collDiff, $keyGenDiff, $keyLenDiff