1#!/usr/bin/perl 2# ******************************************************************** 3# Copyright (C) 2016 and later: Unicode, Inc. and others. 4# License & terms of use: http://www.unicode.org/copyright.html#License 5# ******************************************************************** 6# ******************************************************************** 7# COPYRIGHT: 8# Copyright (c) 2013-2014, International Business Machines Corporation and 9# others. All Rights Reserved. 10# ******************************************************************** 11 12# Variables need to be set in ../perldriver/Common.pl for where ICU is on your machine. 13# Copy Common.pl.template to Common.pl and modify it. 14# 15# Sample Common.pl "Settings by user" for a Linux out-of-source build: 16# 17# $ICULatestVersion = "collv2"; 18# $ICUPreviousVersion = "52"; 19# 20# $PerformanceDataPath = "/home/mscherer/svn.icudata/trunk/src/test/perf"; 21# 22# $ICULatest = "/home/mscherer/svn.icu/collv2/bld"; 23# $ICUPrevious = "/home/mscherer/svn.icu/trunk/bld"; 24# 25# The first time around, you also need to 26# source/test/perf/collperf2$ mkdir ../results 27# Then invoke 28# source/test/perf/collperf2$ ./CollPerf2_r.pl 29# 30# Sample debug invocation: 31# ~/svn.icu/trunk/dbg/test/perf/collperf2$ LD_LIBRARY_PATH=../../../lib:../../../tools/ctestfw ./collperf2 -t 5 -p 1 -L "de" -f /home/mscherer/svn.icudata/trunk/src/test/perf/collation/TestNames_Latin.txt TestStringPieceSort 32 33#use strict; 34 35use lib '../perldriver'; 36 37require "../perldriver/Common.pl"; 38 39use PerfFramework; 40 41my $options = { 42 "title"=>"Collation Performance Regression: ICU (".$ICUPreviousVersion." and ".$ICULatestVersion.")", 43 "headers"=>"ICU".$ICUPreviousVersion." ICU".$ICULatestVersion, 44 "operationIs"=>"Collator", 45 "passes"=>"1", 46 "time"=>"2", 47 #"outputType"=>"HTML", 48 "dataDir"=>$CollationDataPath, 49 "outputDir"=>"../results" 50}; 51 52# programs 53# tests will be done for all the programs. Results will be stored and connected 54my $p1, $p2; 55 56if ($OnWindows) { 57 $p1 = "cd ".$ICUPrevious."/bin && ".$ICUPathPrevious."/collperf2/$WindowsPlatform/Release/collperf2.exe"; 58 $p2 = "cd ".$ICULatest."/bin && ".$ICUPathLatest."/collperf2/$WindowsPlatform/Release/collperf2.exe"; 59} else { 60 $p1 = "LD_LIBRARY_PATH=".$ICUPrevious."/lib:".$ICUPrevious."/tools/ctestfw ".$ICUPrevious."/test/perf/collperf2/collperf2"; 61 $p2 = "LD_LIBRARY_PATH=".$ICULatest."/lib:".$ICULatest."/tools/ctestfw ".$ICULatest."/test/perf/collperf2/collperf2"; 62} 63 64my $tests = { 65 "ucol_strcoll/len", ["$p1,TestStrcoll", "$p2,TestStrcoll"], 66 "ucol_strcoll/null", ["$p1,TestStrcollNull", "$p2,TestStrcollNull"], 67 "ucol_strcoll/len/similar", ["$p1,TestStrcollSimilar", "$p2,TestStrcollSimilar"], 68 69 "ucol_strcollUTF8/len", ["$p1,TestStrcollUTF8", "$p2,TestStrcollUTF8"], 70 "ucol_strcollUTF8/null", ["$p1,TestStrcollUTF8Null", "$p2,TestStrcollUTF8Null"], 71 "ucol_strcollUTF8/len/similar", ["$p1,TestStrcollUTF8Similar", "$p2,TestStrcollUTF8Similar"], 72 73 "ucol_getSortKey/len", ["$p1,TestGetSortKey", "$p2,TestGetSortKey"], 74 "ucol_getSortKey/null", ["$p1,TestGetSortKeyNull", "$p2,TestGetSortKeyNull"], 75 76 "ucol_nextSortKeyPart/4_all", ["$p1,TestNextSortKeyPart_4All", "$p2,TestNextSortKeyPart_4All"], 77 "ucol_nextSortKeyPart/4x4", ["$p1,TestNextSortKeyPart_4x4", "$p2,TestNextSortKeyPart_4x4"], 78 "ucol_nextSortKeyPart/4x8", ["$p1,TestNextSortKeyPart_4x8", "$p2,TestNextSortKeyPart_4x8"], 79 "ucol_nextSortKeyPart/32_all", ["$p1,TestNextSortKeyPart_32All", "$p2,TestNextSortKeyPart_32All"], 80 "ucol_nextSortKeyPart/32x2", ["$p1,TestNextSortKeyPart_32x2", "$p2,TestNextSortKeyPart_32x2"], 81 82 "ucol_nextSortKeyPart/UTF8/4_all", ["$p1,TestNextSortKeyPartUTF8_4All", "$p2,TestNextSortKeyPartUTF8_4All"], 83 "ucol_nextSortKeyPart/UTF8/4x4", ["$p1,TestNextSortKeyPartUTF8_4x4", "$p2,TestNextSortKeyPartUTF8_4x4"], 84 "ucol_nextSortKeyPart/UTF8/4x8", ["$p1,TestNextSortKeyPartUTF8_4x8", "$p2,TestNextSortKeyPartUTF8_4x8"], 85 "ucol_nextSortKeyPart/UTF8/32_all", ["$p1,TestNextSortKeyPartUTF8_32All", "$p2,TestNextSortKeyPartUTF8_32All"], 86 "ucol_nextSortKeyPart/UTF8/32x2", ["$p1,TestNextSortKeyPartUTF8_32x2", "$p2,TestNextSortKeyPartUTF8_32x2"], 87 88 "Collator::compare/len", ["$p1,TestCppCompare", "$p2,TestCppCompare"], 89 "Collator::compare/null", ["$p1,TestCppCompareNull", "$p2,TestCppCompareNull"], 90 "Collator::compare/len/similar", ["$p1,TestCppCompareSimilar", "$p2,TestCppCompareSimilar"], 91 92 "Collator::compareUTF8/len", ["$p1,TestCppCompareUTF8", "$p2,TestCppCompareUTF8"], 93 "Collator::compareUTF8/null", ["$p1,TestCppCompareUTF8Null", "$p2,TestCppCompareUTF8Null"], 94 "Collator::compareUTF8/len/similar", ["$p1,TestCppCompareUTF8Similar", "$p2,TestCppCompareUTF8Similar"], 95 96 "Collator::getCollationKey/len", ["$p1,TestCppGetCollationKey", "$p2,TestCppGetCollationKey"], 97 "Collator::getCollationKey/null", ["$p1,TestCppGetCollationKeyNull", "$p2,TestCppGetCollationKeyNull"], 98 99 "sort UnicodeString*[]: compare()", ["$p1,TestUniStrSort", "$p2,TestUniStrSort"], 100 "sort StringPiece[]: compareUTF8()", ["$p1,TestStringPieceSortCpp", "$p2,TestStringPieceSortCpp"], 101 "sort StringPiece[]: ucol_strcollUTF8()", ["$p1,TestStringPieceSortC", "$p2,TestStringPieceSortC"], 102 103 "binary search UnicodeString*[]: compare()", ["$p1,TestUniStrBinSearch", "$p2,TestUniStrBinSearch"], 104 "binary search StringPiece[]: compareUTF8()", ["$p1,TestStringPieceBinSearchCpp", "$p2,TestStringPieceBinSearchCpp"], 105 "binary search StringPiece[]: ucol_strcollUTF8()", ["$p1,TestStringPieceBinSearchC", "$p2,TestStringPieceBinSearchC"], 106}; 107 108my $dataFiles = { 109 "en_US", 110 [ 111 "TestNames_Latin.txt" 112 ], 113 114 "de-u-co-phonebk-ks-level2", 115 [ 116 "TestRandomWordsUDHR_de.txt" 117 ], 118 119 "fr-u-ks-level1-kc", 120 [ 121 "TestRandomWordsUDHR_fr.txt" 122 ], 123 124 "es", 125 [ 126 "TestRandomWordsUDHR_es.txt" 127 ], 128 129 "pl", 130 [ 131 "TestRandomWordsUDHR_pl.txt" 132 ], 133 134 "tr", 135 [ 136 "TestRandomWordsUDHR_tr.txt" 137 ], 138 139 "el", 140 [ 141 "TestRandomWordsUDHR_el.txt" 142 ], 143 144 "ru", 145 [ 146 "TestNames_Russian.txt" 147 ], 148 149 "ru-u-ks-level4-ka-shifted", 150 [ 151 "TestRandomWordsUDHR_ru.txt" 152 ], 153 154 "ja", 155 [ 156 "TestNames_Japanese.txt", 157 "TestNames_Japanese_h.txt", 158 "TestNames_Japanese_k.txt" 159 ], 160 161 "ja-u-ks-identic", 162 [ 163 "TestNames_Latin.txt", 164 "TestNames_Japanese.txt" 165 ], 166 167 "ko", 168 [ 169 "TestNames_Korean.txt" 170 ], 171 172 "zh_Hans", 173 [ 174 "TestNames_Simplified_Chinese.txt" 175 ], 176 177 "zh_Hans-u-co-pinyin", 178 [ 179 "TestNames_Latin.txt", 180 "TestNames_Simplified_Chinese.txt" 181 ], 182 183 "zh_Hant", 184 [ 185 "TestNames_Chinese.txt", 186 ], 187 188 "th-u-kk-ka-shifted", 189 [ 190 "TestNames_Latin.txt", 191 "TestNames_Thai.txt", 192 "TestRandomWordsUDHR_th.txt" 193 ], 194 195 "ar", 196 [ 197 "TestRandomWordsUDHR_ar.txt" 198 ], 199 200 "he", 201 [ 202 "TestRandomWordsUDHR_he.txt" 203 ] 204}; 205 206runTests($options, $tests, $dataFiles); 207