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) 2003-2013, International Business Machines Corporation and
9#  * others. All Rights Reserved.
10#  ********************************************************************
11
12
13#use strict;
14
15require "../perldriver/Common.pl";
16
17use lib '../perldriver';
18
19use PerfFramework;
20
21my $options = {
22    "title"=>"Unicode String performance: ICU ".$ICULatestVersion." vs. STDLib",
23    "headers"=>"StdLib ICU".$ICULatestVersion,
24    "operationIs"=>"Unicode String",
25    "timePerOperationIs"=>"Time per Unicode String",
26    "passes"=>"5",
27    "time"=>"2",
28    #"outputType"=>"HTML",
29    "dataDir"=>$CollationDataPath,
30    "outputDir"=>"../results"
31};
32
33
34# programs
35# tests will be done for all the programs. Results will be stored and connected
36my $p;
37if ($OnWindows) {
38    $p = "cd ".$ICULatest."/bin && ".$ICUPathLatest."/ustrperf/$WindowsPlatform/Release/stringperf.exe -l -u";
39} else {
40    $p = "LD_LIBRARY_PATH=".$ICULatest."/source/lib:".$ICULatest."/source/tools/ctestfw ".$ICUPathLatest."/ustrperf/stringperf -l -u";
41}
42
43my $tests = {
44    "Object Construction(empty string)",      ["$p,TestStdLibCtor"         , "$p,TestCtor"         ],
45    "Object Construction(single char)",       ["$p,TestStdLibCtor1"        , "$p,TestCtor1"        ],
46    "Object Construction(another string)",    ["$p,TestStdLibCtor2"        , "$p,TestCtor2"        ],
47    "Object Construction(string literal)",    ["$p,TestStdLibCtor3"        , "$p,TestCtor3"        ],
48    "String Assignment(helper)",              ["$p,TestStdLibAssign"       , "$p,TestAssign"       ],
49    "String Assignment(string literal)",      ["$p,TestStdLibAssign1"      , "$p,TestAssign1"      ],
50    "String Assignment(another string)",      ["$p,TestStdLibAssign2"      , "$p,TestAssign2"      ],
51    "Get String or Character",                ["$p,TestStdLibGetch"        , "$p,TestGetch"        ],
52    "Concatenation",                          ["$p,TestStdLibCatenate"     , "$p,TestCatenate"     ],
53    "String Scanning(char)",                  ["$p,TestStdLibScan"         , "$p,TestScan"         ],
54    "String Scanning(string)",                ["$p,TestStdLibScan1"        , "$p,TestScan1"        ],
55    "String Scanning(char set)",              ["$p,TestStdLibScan2"        , "$p,TestScan2"        ],
56};
57
58my $dataFiles = {
59    "",
60    [
61        "TestNames_Asian.txt",
62        "TestNames_Chinese.txt",
63        "TestNames_Simplified_Chinese.txt",
64        "TestNames_Japanese_h.txt",
65        "TestNames_Japanese_k.txt",
66        "TestNames_Korean.txt",
67        "TestNames_Latin.txt",
68        "TestNames_SerbianSH.txt",
69        "TestNames_SerbianSR.txt",
70        "TestNames_Thai.txt",
71        "Testnames_Russian.txt",
72        "th18057.txt",
73    ]
74};
75
76runTests($options, $tests, $dataFiles);
77
78# The whole command line would be something like:
79# 	stringperf.exe -p 5 -t 2 -f c:/src/data/perf/TestNames_Asian.txt -l -u TestStdLibCatenate
80