• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# -*- mode: org -*-
2# Copyright (C) 2016 and later: Unicode, Inc. and others.
3# License & terms of use: http://www.unicode.org/copyright.html
4#
5# Copyright (C) 2012 International Business Machines Corporation and Others. All Rights Reserved.
6
7How Expensive Is It?
8
9* Introduction
10** The purpose of this test is to answer the question, "How expensive, relatively speaking, is ICU operation X?"
11** ICU tests are compared with general purpose CPU operations to attempt to factor out differences between systems and load conditions
12** Different ICU operations will have different levels of dependence on CPU, memory, disk, etc. So nothing can perfectly factor these conditions out.
13* Running the Test
14** Simply run "make check" in this directory, icu/source/test/perf/howExpensiveIs/
15** Try to minimize other CPU loading throughout the test
16** The test will take some time to run!
17** Test runs outside of a margin of error will be thrown out. So, this will tend to produce more accurate results.
18** After some time, the file howexpensive.xml will be created (an example is attached as Appendix I)
19** The results may be read directly or processed such as with xslt.
20** XML file contents:
21*** Element <tests>: the outermost element.
22*** Attribute 'icu':  gives the basic ICU version number.
23**** Element <test>: a particularized test.
24***** Attribute 'name': names the particular test, see howExpensiveIs.cpp for details
25***** Attribute 'standardizedTime': The SieveTest by definition has a standardized test of 1, it runs a prime number sieve as a benchmark. All other standardizedTimes are normalized against this value.
26***** Attribute 'realDuration': the actual duration, in seconds, of the test.
27***** Attribute 'marginOfError': the amount +/- error for the real duration. Gives an idea of how much variability was in the test.
28***** Attribute 'iterations': gives the total number of iterations run.
29**** Element <icuSystemParams>: This element gives the full details of the target platform, in the XML format produced by the 'icuinfo' tool.  The contents are informative only and not documented here.
30* Analysis
31** The data shows that, for example, parsing a number and opening the GB18030 converter are about the same cost. It also shows that opening a number formatter is about 60 times as expensive as formatting a number.
32** Appendix II shows a .CSV (spreadsheet) file which shows analysis of a sample run between different systems.
33** The Variation column for each Target system was calculated with the formula:  "(Control-Target)/Control" where Control and Target are the standardized times for the Control and Target systems, respectively.
34* Appendices
35** Appendix I: Sample File
36<?xml version="1.0" encoding="UTF-8" ?>
37<tests icu="49.0.2">
38<!--  Copyright (C) 2011, International Business Machines Corporation and others. All Rights Reserved.  -->
39   <test name="SieveTest" standardizedTime="1.000000" realDuration="0.022804" marginOfError="0.000073" iterations="1000000" />
40   <test name="NullTest" standardizedTime="0.000017" realDuration="0.000000" marginOfError="0.000000" iterations="1000000" />
41   <test name="NumParseTest" standardizedTime="77.869922" realDuration="1.775721" marginOfError="0.011742" iterations="1000000" />
42   <test name="Test_unum_opendefault" standardizedTime="4855.974258" realDuration="110.734117" marginOfError="0.057131" iterations="1000000" />
43   <test name="Test_ucnv_opengb18030" standardizedTime="70.488403" realDuration="1.607395" marginOfError="0.009261" iterations="1000000" />
44 <icuSystemParams type="icu4c">
45    <param name="copyright"> Copyright (C) 2011, International Business Machines Corporation and others. All Rights Reserved. </param>
46    <param name="product">icu4c</param>
47    <param name="product.full">International Components for Unicode for C/C++</param>
48    <param name="version">49.0.2</param>
49    <param name="version.unicode">6.1</param>
50    <param name="platform.number">4000</param>
51    <param name="platform.type">Other (POSIX-like)</param>
52    <param name="locale.default">en_US</param>
53    <param name="locale.default.bcp47">en-US</param>
54    <param name="converter.default">UTF-8</param>
55    <param name="icudata.name">icudt49l</param>
56    <param name="icudata.path">../../data/out/build/icudt49l</param>
57    <param name="cldr.version">21.0</param>
58    <param name="tz.version">2011n</param>
59    <param name="tz.default">America/Los_Angeles</param>
60    <param name="cpu.bits">64</param>
61    <param name="cpu.big_endian">0</param>
62    <param name="os.wchar_width">4</param>
63    <param name="os.charset_family">0</param>
64    <param name="os.host">x86_64-unknown-linux-gnu</param>
65    <param name="build.build">x86_64-unknown-linux-gnu</param>
66    <param name="build.cc">gcc</param>
67    <param name="build.cxx">g++</param>
68 </icuSystemParams>
69</tests>
70** Appendix II: Analysis.csv
71https://unicode-org.atlassian.net/browse/ICU-8653,"""Control"", linux i7
72Intel(R) Core(TM) i7-2720QM CPU @ 2.20GHz",MacBook 2.4ghz (Core2D),MacBook 2GhzCore2,AIX Power,MB 2.4 Variance,MB 2 variance,AIX Variance
73SieveTest (=1.0),1,1,1,1,0.00%,0.00%,0.00%
74NullTest (=0.0),0,0,0,0.08,#DIV/0!,#DIV/0!,#DIV/0!
75NumParseTest,74.10642,21.220191493,56.912133,85.423525612,71.37%,23.20%,-15.27%
76Test_unum_opendefault,4801.617798,1912.860018319,4522.900036,2580.805294162,60.16%,5.80%,46.25%
77Test_ucnv_opengb18030,65.268309,30.547740077,84.075584,51.587649619,53.20%,-28.82%,20.96%
78Test_unum_openpattern,4394.214773,1735.453339382,4472.298154,2263.471671239,60.51%,-1.78%,48.49%
79Test_ures_openroot,75.302253,23.773982586,71.248439,57.471889114,68.43%,5.38%,23.68%
80** Appendix III: Revision History
81*** Feb 2012, ICU 49, srl: First revision
82