diff --git a/icu4c/source/test/perf/charperf/CharPerf.pl b/icu4c/source/test/perf/charperf/CharPerf.pl new file mode 100755 index 0000000000..a2cfa83124 --- /dev/null +++ b/icu4c/source/test/perf/charperf/CharPerf.pl @@ -0,0 +1,42 @@ +#!/usr/bin/perl -w + +use strict; + +use lib '../perldriver'; + +use PerfFramework; + +my $options = { + "title"=>"Character property performance: ICU vs. STDLib", + "headers"=>"StdLib ICU", + "operationIs"=>"code point", + "timePerOperationIs"=>"Time per code point", + "passes"=>"10", + "time"=>"5", + #"outputType"=>"HTML", + "dataDir"=>"c:/src/perf/data", + "outputDir"=>"../results" + }; + + +# programs +# tests will be done for all the programs. Results will be stored and connected +my $p = "charperf.exe"; + +my $tests = { +"isAlpha", ["$p TestStdLibIsAlpha" , "$p TestIsAlpha" ], +"isUpper", ["$p TestStdLibIsUpper" , "$p TestIsUpper" ], +"isLower", ["$p TestStdLibIsLower" , "$p TestIsLower" ], +"isDigit", ["$p TestStdLibIsDigit" , "$p TestIsDigit" ], +"isSpace", ["$p TestStdLibIsSpace" , "$p TestIsSpace" ], +"isAlphaNumeric", ["$p TestStdLibIsAlphaNumeric" , "$p TestIsAlphaNumeric" ], +"isPrint", ["$p TestStdLibIsPrint" , "$p TestIsPrint" ], +"isControl", ["$p TestStdLibIsControl" , "$p TestIsControl" ], +"toLower", ["$p TestStdLibToLower" , "$p TestToLower" ], +"toUpper", ["$p TestStdLibToUpper" , "$p TestToUpper" ], +"isWhiteSpace", ["$p TestStdLibIsWhiteSpace" , "$p TestIsWhiteSpace" ], +}; + +my $dataFiles; + +runTests($options, $tests, $dataFiles); diff --git a/icu4c/source/test/perf/normperf/NormPerf.pl b/icu4c/source/test/perf/normperf/NormPerf.pl index 78f365a60a..b8e784ad2b 100755 --- a/icu4c/source/test/perf/normperf/NormPerf.pl +++ b/icu4c/source/test/perf/normperf/NormPerf.pl @@ -9,13 +9,12 @@ use PerfFramework; my $options = { "title"=>"Normalization performance: ICU vs. Win", - "headers"=>"ICU Win", - "operationIs"=>"File size in code points", - "timePerOperationIs"=>"Time per code point", - #"passes"=>"10", - #"time"=>"5", + "headers"=>"Win ICU", + "operationIs"=>"code point", + "passes"=>"10", + "time"=>"5", + #"outputType"=>"HTML", "dataDir"=>"c:/src/perf/data", - "outputType"=>"HTML", "outputDir"=>"../results" }; @@ -24,31 +23,31 @@ my $options = { my $p = "normperf.exe -b -u"; my $tests = { - "NFC_NFD_Text", ["$p TestICU_NFC_NFD_Text", "$p TestWin_NFC_NFD_Text" ], - "NFC_NFC_Text", ["$p TestICU_NFC_NFC_Text", "$p TestWin_NFC_NFC_Text" ], - "NFC_Orig_Text", ["$p TestICU_NFC_Orig_Text", "$p TestWin_NFC_Orig_Text"], - "NFD_NFD_Text", ["$p TestICU_NFD_NFD_Text", "$p TestWin_NFD_NFD_Text" ], - "NFD_NFC_Text", ["$p TestICU_NFD_NFC_Text", "$p TestWin_NFD_NFC_Text" ], - "NFD_Orig_Text", ["$p TestICU_NFD_Orig_Text", "$p TestWin_NFD_Orig_Text"] + "NFC_NFD_Text", ["$p TestWin_NFC_NFD_Text" , "$p TestICU_NFC_NFD_Text" ], + "NFC_NFC_Text", ["$p TestWin_NFC_NFC_Text" , "$p TestICU_NFC_NFC_Text" ], + "NFC_Orig_Text", ["$p TestWin_NFC_Orig_Text" , "$p TestICU_NFC_Orig_Text"], + "NFD_NFD_Text", ["$p TestWin_NFD_NFD_Text" , "$p TestICU_NFD_NFD_Text" ], + "NFD_NFC_Text", ["$p TestWin_NFD_NFC_Text" , "$p TestICU_NFD_NFC_Text" ], + "NFD_Orig_Text", ["$p TestWin_NFD_Orig_Text" , "$p TestICU_NFD_Orig_Text"] }; my $dataFiles = { "", [ -# "TestNames_Asian.txt", -# "TestNames_Chinese.txt", + "TestNames_Asian.txt", + "TestNames_Chinese.txt", "TestNames_Japanese.txt", "TestNames_Japanese_h.txt", "TestNames_Japanese_k.txt", -# "TestNames_Korean.txt", -# "TestNames_Latin.txt", -# "TestNames_SerbianSH.txt", -# "TestNames_SerbianSR.txt", -# "TestNames_Thai.txt", -# "Testnames_Russian.txt", -# "th18057.txt", -# "thesis.txt", -# "vfear11a.txt", + "TestNames_Korean.txt", + "TestNames_Latin.txt", + "TestNames_SerbianSH.txt", + "TestNames_SerbianSR.txt", + "TestNames_Thai.txt", + "Testnames_Russian.txt", + "th18057.txt", + "thesis.txt", + "vfear11a.txt", ] }; diff --git a/icu4c/source/test/perf/perldriver/Output.pm b/icu4c/source/test/perf/perldriver/Output.pm index 34119605df..9f0d091bec 100644 --- a/icu4c/source/test/perf/perldriver/Output.pm +++ b/icu4c/source/test/perf/perldriver/Output.pm @@ -2,15 +2,25 @@ use strict; +use Dataset; + my $TABLEATTR = 'BORDER="1" CELLPADDING="4" CELLSPACING="0"'; my $outType = "HTML"; my $html = "noName"; my $inTable; my @headers; -my @timetypes = ("per iteration", "per operation", "events", "per event"); +my @timetypes = ("mean per op", "error per op", "events", "per event"); my %raw; -my $current; +my $current = ""; my $exp = 0; +my $mult = 1e9; #use nanoseconds +my $perc = 100; #for percent +my $printEvents = 0; +my $legend = "\n

Table legend

\n"; + print HTML $legend; printRaw(); print HTML < @@ -125,23 +205,59 @@ sub printRaw { print HTML "

Raw data

"; my $key; my $i; + my $j; + my $k; + print HTML "\n"; for $key (sort keys %raw) { - print HTML $key; - foreach $i ( 0 .. $#{ $raw{$key} } ) { - print HTML " $i = $raw{$key}[$i]"; - } - - + my $printkey = $key; + $printkey =~ s/\/ /; + if($printEvents) { + print HTML "\n"; # locale and data file + print HTML "\n"; + } else { + print HTML "\n"; # locale and data file + print HTML "\n"; + } + + + for $i ( $raw{$key} ) { + print HTML ""; + for $j ( @$i ) { + my ($test, $args); + ($test, $args) = split(/,/, shift(@$j)); + print HTML ""; + print HTML ""; + + #print HTML ""; + print HTML ""; + print HTML ""; + my @data = @{ shift(@$j) }; +# for $k (@data) { +# print HTML "$k, "; +# } + my $ds = Dataset->new(@data); + print HTML ""; + if($#{ $j } >= 0) { + print HTML ""; + } + print HTML "\n"; + } + } +# print HTML "
\n"; } - print %raw; +# print %raw; +} + +sub store { + $raw{$current}[$exp++] = [@_]; } sub outputRow { - $raw{$current}[$exp++] = [@_]; + #$raw{$current}[$exp++] = [@_]; my $testName = shift; my @iterPerPass = @{shift(@_)}; my @noopers = @{shift(@_)}; - my @timedata = @{shift(@_)}; + my @timedata = @{shift(@_)}; my @noevents; if($#_ >= 0) { @noevents = @{shift(@_)}; @@ -149,7 +265,8 @@ sub outputRow { if(!$inTable) { if(@noevents) { debug("Have events header\n"); - startTable(1); + $printEvents = 1; + startTable; } else { debug("No events header\n"); startTable; @@ -161,29 +278,43 @@ sub outputRow { # Finished one row of results. Outputting newRow; - outputData($testName); + outputData($testName, "LEFT"); #outputData($iterCount); - outputData($noopers[0]); - for $j ( 0 .. $#timedata ) { - my $perOperation = $timedata[$j]->divideByScalar($iterPerPass[$j]); # time per operation - #debug("Time per operation: ".formatSeconds(4, $perOperation->getMean, $perOperation->getError)."\n"); - outputData(formatSeconds(4, $perOperation->getMean, $perOperation->getError)); - } - for $j ( 0 .. $#timedata ) { - my $perOperation = $timedata[$j]->divideByScalar($iterPerPass[$j]*$noopers[$j]); # time per operation - #debug("Time per operation: ".formatSeconds(4, $perOperation->getMean, $perOperation->getError)."\n"); - outputData(formatSeconds(4, $perOperation->getMean, $perOperation->getError)); - } + outputData($noopers[0], "RIGHT"); - if(@noevents) { + if(!$printEvents) { for $j ( 0 .. $#timedata ) { - outputData($noevents[$j]); + my $perOperation = $timedata[$j]->divideByScalar($iterPerPass[$j]*$noopers[$j]); # time per operation + #debug("Time per operation: ".formatSeconds(4, $perOperation->getMean, $perOperation->getError)."\n"); + outputData(formatNumber(2, $mult, $perOperation->getMean), "RIGHT"); + outputData(formatNumber(2, $mult, $perOperation->getError), "RIGHT"); + } + } + my $baseLinePO = $timedata[0]->divideByScalar($iterPerPass[0]*$noopers[0]); + for $j ( 1 .. $#timedata ) { + my $perOperation = $timedata[$j]->divideByScalar($iterPerPass[$j]*$noopers[$j]); # time per operation + my $ratio = $baseLinePO->subtract($perOperation); + $ratio = $ratio->divide($perOperation); + outputData(formatPercent(2, $ratio->getMean), "RIGHT"); + outputData(formatPercent(2, $ratio->getError), "RIGHT"); + } + if (@noevents) { + for $j ( 0 .. $#timedata ) { + outputData($noevents[$j], "RIGHT"); } - for $j ( 0 .. $#timedata ) { my $perEvent = $timedata[$j]->divideByScalar($iterPerPass[$j]*$noevents[$j]); # time per event #debug("Time per operation: ".formatSeconds(4, $perEvent->getMean, $perEvent->getError)."\n"); - outputData(formatSeconds(4, $perEvent->getMean, $perEvent->getError)); + outputData(formatNumber(2, $mult, $perEvent->getMean), "RIGHT"); + outputData(formatNumber(2, $mult, $perEvent->getError), "RIGHT"); + } + my $baseLinePO = $timedata[0]->divideByScalar($iterPerPass[0]*$noevents[0]); + for $j ( 1 .. $#timedata ) { + my $perOperation = $timedata[$j]->divideByScalar($iterPerPass[$j]*$noevents[$j]); # time per operation + my $ratio = $baseLinePO->subtract($perOperation); + $ratio = $ratio->divide($perOperation); + outputData(formatPercent(2, $ratio->getMean), "RIGHT"); + outputData(formatPercent(2, $ratio->getError), "RIGHT"); } } } diff --git a/icu4c/source/test/perf/perldriver/PerfFramework.pm b/icu4c/source/test/perf/perldriver/PerfFramework.pm index 0c7fbcb89a..4f1b8b0bd1 100644 --- a/icu4c/source/test/perf/perldriver/PerfFramework.pm +++ b/icu4c/source/test/perf/perldriver/PerfFramework.pm @@ -2,7 +2,7 @@ use strict; -use Dataset; +#use Dataset; use Format; use Output; @@ -108,7 +108,10 @@ sub compareLoop { # first we calibrate. Use time from somewhere # first test is used for calibration ($program, @argsAndTest) = split(/\ /, @{ $tests{$i} }[$j]); - my @res = measure1("$program -t $TIME -p $NUMPASSES $locAndData @argsAndTest"); + my $commandLine = "$program -t $TIME -p $NUMPASSES $locAndData @argsAndTest"; + #my $commandLine = "$program -i 5 -p $NUMPASSES $locAndData @argsAndTest"; + my @res = measure1($commandLine); + store("$i, $program @argsAndTest", @res); push(@iterPerPass, shift(@res)); push(@noopers, shift(@res)); diff --git a/icu4c/source/test/perf/ubrkperf/UBrkPerf.pl b/icu4c/source/test/perf/ubrkperf/UBrkPerf.pl index 128a939924..1ce38bd73d 100755 --- a/icu4c/source/test/perf/ubrkperf/UBrkPerf.pl +++ b/icu4c/source/test/perf/ubrkperf/UBrkPerf.pl @@ -7,14 +7,14 @@ use lib '../perldriver'; use PerfFramework; my $options = { - "title"=>"BreakIterator performance: ICU 2.0 vs. ICU 2.4", - "headers"=>"ICU20 ICU24", - "operationIs"=>"File size in code points", - "timePerOperationIs"=>"Time per code point", - "passes"=>"3", - #"time"=>"1.1", + "title"=>"BreakIterator performance regression (ICU 2.0, 2.2 and 2.4)", + "headers"=>"ICU20 ICU22 ICU24", + "operationIs"=>"code point", + "eventIs"=>"break", + "passes"=>"10", + "time"=>"5", + #"outputType"=>"HTML", "dataDir"=>"c:/src/perf/data", - "outputType"=>"HTML", "outputDir"=>"../results" }; @@ -34,40 +34,41 @@ if(@_ >= 0) { } my $p1 = "ubrkperf20.exe"; -my $p2 = "ubrkperf24.exe"; +my $p2 = "ubrkperf22.exe"; +my $p3 = "ubrkperf24.exe"; my $dataFiles = { "en", ["thesis.txt", -# #"2drvb10.txt", -# #"ulyss10.txt", -# "nvsbl10.txt", -# "vfear11a.txt", -# "TestNames_Asian.txt", -# "TestNames_Chinese.txt", + #"2drvb10.txt", + #"ulyss10.txt", + "nvsbl10.txt", + "vfear11a.txt", + "TestNames_Asian.txt", + "TestNames_Chinese.txt", "TestNames_Japanese.txt", -# "TestNames_Japanese_h.txt", -# "TestNames_Japanese_k.txt", -# "TestNames_Korean.txt", + "TestNames_Japanese_h.txt", + "TestNames_Japanese_k.txt", + "TestNames_Korean.txt", "TestNames_Latin.txt", -# "TestNames_SerbianSH.txt", -# "TestNames_SerbianSR.txt", -# "TestNames_Thai.txt", -# "Testnames_Russian.txt", + "TestNames_SerbianSH.txt", + "TestNames_SerbianSR.txt", + "TestNames_Thai.txt", + "Testnames_Russian.txt", ], #"th", ["TestNames_Thai.txt", "th18057.txt"] }; my $tests = { -"TestForwardChar", ["$p1 $m1 TestICUForward", "$p2 $m1 TestICUForward"], -"TestForwardWord", ["$p1 $m2 TestICUForward", "$p2 $m2 TestICUForward"], -#"TestForwardLine", ["$p1 $m3 TestICUForward", "$p2 $m3 TestICUForward"], -#"TestForwardSentence", ["$p1 $m4 TestICUForward", "$p2 $m4 TestICUForward"], - -#"TestIsBoundChar", ["$p1 $m1 TestICUIsBound", "$p2 $m1 TestICUIsBound"], -#"TestIsBoundWord", ["$p1 $m2 TestICUIsBound", "$p2 $m2 TestICUIsBound"], -#"TestIsBoundLine", ["$p1 $m3 TestICUIsBound", "$p2 $m3 TestICUIsBound"], -#"TestIsBoundSentence", ["$p1 $m4 TestICUIsBound", "$p2 $m4 TestICUIsBound"], +"TestForwardChar", ["$p1 $m1 TestICUForward", "$p2 $m1 TestICUForward", "$p3 $m1 TestICUForward"], +"TestForwardWord", ["$p1 $m2 TestICUForward", "$p2 $m2 TestICUForward", "$p3 $m2 TestICUForward"], +"TestForwardLine", ["$p1 $m3 TestICUForward", "$p2 $m3 TestICUForward", "$p3 $m3 TestICUForward"], +"TestForwardSentence", ["$p1 $m4 TestICUForward", "$p2 $m4 TestICUForward", "$p3 $m4 TestICUForward"], + +"TestIsBoundChar", ["$p1 $m1 TestICUIsBound", "$p2 $m1 TestICUIsBound", "$p3 $m1 TestICUIsBound"], +"TestIsBoundWord", ["$p1 $m2 TestICUIsBound", "$p2 $m2 TestICUIsBound", "$p3 $m2 TestICUIsBound"], +"TestIsBoundLine", ["$p1 $m3 TestICUIsBound", "$p2 $m3 TestICUIsBound", "$p3 $m3 TestICUIsBound"], +"TestIsBoundSentence", ["$p1 $m4 TestICUIsBound", "$p2 $m4 TestICUIsBound", "$p3 $m4 TestICUIsBound"], };
$printkey
test nameinteresting argumentsiterationsoperationsmean time (ns)error (ns)events
$printkey
test nameinteresting argumentsiterationsoperationsmean time (ns)error (ns)
".$test."".$args."".shift(@$j)."".shift(@$j)."".shift(@$j)."".formatNumber(4, $mult, $ds->getMean)."".formatNumber(4, $mult, $ds->getError)."".shift(@$j)."