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