mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-14 09:21:03 +00:00
ICU-5801 Clean up SVN file properties, mergine fix #5905 from trunk to maint-3-8
X-SVN-Rev: 22617
This commit is contained in:
parent
4371396e9b
commit
668bb96bfd
449 changed files with 13963 additions and 14013 deletions
50
.gitattributes
vendored
50
.gitattributes
vendored
|
@ -54,12 +54,7 @@ README text !eol
|
|||
eclipseProjectMisc/initSrc.launch -text
|
||||
eclipseProjectMisc/normSrc.launch -text
|
||||
/ee.foundation.jar -text
|
||||
/license.html -text
|
||||
/preprocessor.txt -text
|
||||
src/com/ibm/icu/charset/CharsetISCII.java -text
|
||||
src/com/ibm/icu/charset/CharsetUTF16BE.java -text
|
||||
src/com/ibm/icu/charset/CharsetUTF32BE.java -text
|
||||
src/com/ibm/icu/charset/CharsetUTF7.java -text
|
||||
src/com/ibm/icu/dev/data/rbbi/english.dict -text
|
||||
src/com/ibm/icu/dev/data/testdata.jar -text
|
||||
src/com/ibm/icu/dev/data/thai6.ucs -text
|
||||
|
@ -146,7 +141,6 @@ src/com/ibm/icu/dev/eclipse/plugins/com.ibm.icu/plugin.properties -text
|
|||
src/com/ibm/icu/dev/test/calendar/DataDrivenCalendarTest.java -text
|
||||
src/com/ibm/icu/dev/test/calendar/IndianTest.java -text
|
||||
src/com/ibm/icu/dev/test/duration/DataReadWriteTest.java -text
|
||||
src/com/ibm/icu/dev/test/duration/ICUDurationTest.java -text
|
||||
src/com/ibm/icu/dev/test/duration/LanguageTestRoot.java -text
|
||||
src/com/ibm/icu/dev/test/duration/PeriodBuilderFactoryTest.java -text
|
||||
src/com/ibm/icu/dev/test/duration/PeriodBuilderTest.java -text
|
||||
|
@ -184,9 +178,6 @@ src/com/ibm/icu/dev/test/duration/testdata/testdata_zh_Hans_SG.txt -text
|
|||
src/com/ibm/icu/dev/test/duration/testdata/testdata_zh_Hant.txt -text
|
||||
src/com/ibm/icu/dev/test/duration/testdata/testdata_zh_Hant_HK.txt -text
|
||||
src/com/ibm/icu/dev/test/format/DataDrivenFormatTest.java -text
|
||||
src/com/ibm/icu/dev/test/perf/DateFormatPerformanceTest.java -text
|
||||
src/com/ibm/icu/dev/test/perf/DecimalFormatPerformanceTest.java -text
|
||||
src/com/ibm/icu/dev/test/perf/converterperf.pl -text
|
||||
src/com/ibm/icu/dev/test/perf/data/collation/TestNames_Asian.txt -text
|
||||
src/com/ibm/icu/dev/test/perf/data/collation/TestNames_Chinese.txt -text
|
||||
src/com/ibm/icu/dev/test/perf/data/collation/TestNames_Japanese.txt -text
|
||||
|
@ -199,13 +190,6 @@ src/com/ibm/icu/dev/test/perf/data/collation/TestNames_SerbianSH.txt -text
|
|||
src/com/ibm/icu/dev/test/perf/data/collation/TestNames_SerbianSR.txt -text
|
||||
src/com/ibm/icu/dev/test/perf/data/collation/TestNames_Simplified_Chinese.txt -text
|
||||
src/com/ibm/icu/dev/test/perf/data/collation/TestNames_Thai.txt -text
|
||||
src/com/ibm/icu/dev/test/perf/dateformatperf.pl -text
|
||||
src/com/ibm/icu/dev/test/perf/decimalformatperf.pl -text
|
||||
src/com/ibm/icu/dev/test/perf/normalizationperf_r_b.pl -text
|
||||
src/com/ibm/icu/dev/test/perf/normalizationperf_r_l.pl -text
|
||||
src/com/ibm/icu/dev/test/perf/rbbiperf_r.pl -text
|
||||
src/com/ibm/icu/dev/test/perf/ucharacterperf_r.pl -text
|
||||
src/com/ibm/icu/dev/test/perf/unicodesetperf_r.pl -text
|
||||
src/com/ibm/icu/dev/test/rbbi/rbbitst.txt -text
|
||||
src/com/ibm/icu/dev/test/serializable/data/ICU_3.6/com.ibm.icu.impl.OlsonTimeZone.dat -text
|
||||
src/com/ibm/icu/dev/test/serializable/data/ICU_3.6/com.ibm.icu.impl.TimeZoneAdapter.dat -text
|
||||
|
@ -237,14 +221,12 @@ src/com/ibm/icu/dev/test/serializable/data/ICU_3.6/com.ibm.icu.util.SimpleTimeZo
|
|||
src/com/ibm/icu/dev/test/serializable/data/ICU_3.6/com.ibm.icu.util.TimeZone.dat -text
|
||||
src/com/ibm/icu/dev/test/serializable/data/ICU_3.6/com.ibm.icu.util.ULocale.dat -text
|
||||
src/com/ibm/icu/dev/test/serializable/data/ICU_3.6/com.ibm.icu.util.UResourceTypeMismatchException.dat -text
|
||||
src/com/ibm/icu/dev/test/timezone/TimeZoneRuleTest.java -text
|
||||
src/com/ibm/icu/dev/test/util/CalendarFieldsSet.java -text
|
||||
src/com/ibm/icu/dev/test/util/DateTimeStyleSet.java -text
|
||||
src/com/ibm/icu/dev/test/util/DebugUtilities.java -text
|
||||
src/com/ibm/icu/dev/test/util/DebugUtilitiesData.java -text
|
||||
src/com/ibm/icu/dev/test/util/DebugUtilitiesTest.java -text
|
||||
src/com/ibm/icu/dev/test/util/FieldsSet.java -text
|
||||
src/com/ibm/icu/dev/test/util/PrettyPrinter.java -text
|
||||
src/com/ibm/icu/dev/tool/docs/icu4j28.api.gz -text
|
||||
src/com/ibm/icu/dev/tool/docs/icu4j30.api.gz -text
|
||||
src/com/ibm/icu/dev/tool/docs/icu4j32.api.gz -text
|
||||
|
@ -254,21 +236,6 @@ src/com/ibm/icu/dev/tool/docs/icu4j342.api.gz -text
|
|||
src/com/ibm/icu/dev/tool/docs/icu4j343.api.gz -text
|
||||
src/com/ibm/icu/dev/tool/docs/icu4j36.api.gz -text
|
||||
src/com/ibm/icu/dev/tool/docs/icu4j38.api.gz -text
|
||||
src/com/ibm/icu/dev/tool/timezone/ICUZDump.java -text
|
||||
src/com/ibm/icu/dev/tool/tzu/CLILoader.java -text
|
||||
src/com/ibm/icu/dev/tool/tzu/DirectorySearch.txt -text
|
||||
src/com/ibm/icu/dev/tool/tzu/GUILoader.java -text
|
||||
src/com/ibm/icu/dev/tool/tzu/ICUFile.java -text
|
||||
src/com/ibm/icu/dev/tool/tzu/ICUJarFinder.java -text
|
||||
src/com/ibm/icu/dev/tool/tzu/ICUTZUMain.java -text
|
||||
src/com/ibm/icu/dev/tool/tzu/IncludePath.java -text
|
||||
src/com/ibm/icu/dev/tool/tzu/Logger.java -text
|
||||
src/com/ibm/icu/dev/tool/tzu/PathComponent.java -text
|
||||
src/com/ibm/icu/dev/tool/tzu/PathModel.java -text
|
||||
src/com/ibm/icu/dev/tool/tzu/ResultComponent.java -text
|
||||
src/com/ibm/icu/dev/tool/tzu/ResultModel.java -text
|
||||
src/com/ibm/icu/dev/tool/tzu/SourceModel.java -text
|
||||
src/com/ibm/icu/dev/tool/tzu/icu.css -text
|
||||
src/com/ibm/icu/dev/tool/tzu/icu.gif -text
|
||||
src/com/ibm/icu/dev/tool/tzu/runicutzu.bat -text
|
||||
src/com/ibm/icu/dev/tool/tzu/runicutzu.cmd -text
|
||||
|
@ -276,12 +243,8 @@ src/com/ibm/icu/dev/tool/tzu/runicutzu.sh -text
|
|||
src/com/ibm/icu/dev/tool/tzu/runicutzuenv.bat -text
|
||||
src/com/ibm/icu/dev/tool/tzu/runicutzuenv.cmd -text
|
||||
src/com/ibm/icu/dev/tool/tzu/runicutzuenv.sh -text
|
||||
src/com/ibm/icu/impl/ICUCache.java -text
|
||||
src/com/ibm/icu/impl/RelativeDateFormat.java -text
|
||||
src/com/ibm/icu/impl/SimpleCache.java -text
|
||||
src/com/ibm/icu/impl/data/icudata.jar -text
|
||||
src/com/ibm/icu/impl/data/th.brk -text
|
||||
src/com/ibm/icu/impl/duration/BasicDurationFormat.java -text
|
||||
src/com/ibm/icu/impl/duration/BasicDurationFormatter.java -text
|
||||
src/com/ibm/icu/impl/duration/BasicDurationFormatterFactory.java -text
|
||||
src/com/ibm/icu/impl/duration/BasicPeriodBuilderFactory.java -text
|
||||
|
@ -327,19 +290,6 @@ src/com/ibm/icu/impl/duration/impl/data/pfd_zh_Hans_SG.xml -text
|
|||
src/com/ibm/icu/impl/duration/impl/data/pfd_zh_Hant.xml -text
|
||||
src/com/ibm/icu/impl/duration/impl/data/pfd_zh_Hant_HK.xml -text
|
||||
src/com/ibm/icu/text/DurationFormat.java -text
|
||||
src/com/ibm/icu/util/AnnualTimeZoneRule.java -text
|
||||
src/com/ibm/icu/util/BasicTimeZone.java -text
|
||||
src/com/ibm/icu/util/CalendarServiceShim.java -text
|
||||
src/com/ibm/icu/util/DateTimeRule.java -text
|
||||
src/com/ibm/icu/util/IndianCalendar.java -text
|
||||
src/com/ibm/icu/util/InitialTimeZoneRule.java -text
|
||||
src/com/ibm/icu/util/RuleBasedTimeZone.java -text
|
||||
src/com/ibm/icu/util/TaiwanCalendar.java -text
|
||||
src/com/ibm/icu/util/TimeArrayTimeZoneRule.java -text
|
||||
src/com/ibm/icu/util/TimeZoneRule.java -text
|
||||
src/com/ibm/icu/util/TimeZoneTransition.java -text
|
||||
src/com/ibm/icu/util/UResourceBundleIterator.java -text
|
||||
src/com/ibm/icu/util/VTimeZone.java -text
|
||||
src/com/ibm/richtext/textapps/resources/unicode.arabic.red -text
|
||||
src/com/ibm/richtext/textapps/resources/unicode.hebrew.red -text
|
||||
|
||||
|
|
102
license.html
102
license.html
|
@ -1,51 +1,51 @@
|
|||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></meta>
|
||||
<title>ICU License - ICU 1.8.1 and later</title>
|
||||
</head>
|
||||
|
||||
<body BGCOLOR="#ffffff">
|
||||
<h2>ICU License - ICU 1.8.1 and later</h2>
|
||||
|
||||
<p>COPYRIGHT AND PERMISSION NOTICE</p>
|
||||
|
||||
<p>
|
||||
Copyright (c) 1995-2007 International Business Machines Corporation and others
|
||||
</p>
|
||||
<p>
|
||||
All rights reserved.
|
||||
</p>
|
||||
<p>
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, and/or sell
|
||||
copies of the Software, and to permit persons
|
||||
to whom the Software is furnished to do so, provided that the above
|
||||
copyright notice(s) and this permission notice appear in all copies
|
||||
of the Software and that both the above copyright notice(s) and this
|
||||
permission notice appear in supporting documentation.
|
||||
</p>
|
||||
<p>
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL
|
||||
THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM,
|
||||
OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
|
||||
RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
|
||||
USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
</p>
|
||||
<p>
|
||||
Except as contained in this notice, the name of a copyright holder shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings in
|
||||
this Software without prior written authorization of the copyright holder.
|
||||
</p>
|
||||
|
||||
<hr>
|
||||
<p><small>
|
||||
All trademarks and registered trademarks mentioned herein are the property of their respective owners.
|
||||
</small></p>
|
||||
</body>
|
||||
</html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></meta>
|
||||
<title>ICU License - ICU 1.8.1 and later</title>
|
||||
</head>
|
||||
|
||||
<body BGCOLOR="#ffffff">
|
||||
<h2>ICU License - ICU 1.8.1 and later</h2>
|
||||
|
||||
<p>COPYRIGHT AND PERMISSION NOTICE</p>
|
||||
|
||||
<p>
|
||||
Copyright (c) 1995-2007 International Business Machines Corporation and others
|
||||
</p>
|
||||
<p>
|
||||
All rights reserved.
|
||||
</p>
|
||||
<p>
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, and/or sell
|
||||
copies of the Software, and to permit persons
|
||||
to whom the Software is furnished to do so, provided that the above
|
||||
copyright notice(s) and this permission notice appear in all copies
|
||||
of the Software and that both the above copyright notice(s) and this
|
||||
permission notice appear in supporting documentation.
|
||||
</p>
|
||||
<p>
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL
|
||||
THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM,
|
||||
OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
|
||||
RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
|
||||
USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
</p>
|
||||
<p>
|
||||
Except as contained in this notice, the name of a copyright holder shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings in
|
||||
this Software without prior written authorization of the copyright holder.
|
||||
</p>
|
||||
|
||||
<hr>
|
||||
<p><small>
|
||||
All trademarks and registered trademarks mentioned herein are the property of their respective owners.
|
||||
</small></p>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,50 +1,50 @@
|
|||
/**
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2007, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.charset;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
|
||||
class CharsetUTF16BE extends CharsetUTF16 {
|
||||
public CharsetUTF16BE(String icuCanonicalName, String javaCanonicalName, String[] aliases){
|
||||
super(icuCanonicalName, javaCanonicalName, aliases);
|
||||
}
|
||||
class CharsetDecoderUTF16BE extends CharsetDecoderUTF16{
|
||||
|
||||
public CharsetDecoderUTF16BE(CharsetICU cs) {
|
||||
super(cs);
|
||||
}
|
||||
protected CoderResult decodeLoopImpl(ByteBuffer source, CharBuffer target, IntBuffer offsets, boolean flush){
|
||||
return decodeLoopUTF16BE(source, target, offsets, flush);
|
||||
}
|
||||
}
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new CharsetDecoderUTF16BE(this);
|
||||
}
|
||||
class CharsetEncoderUTF16BE extends CharsetEncoderUTF16{
|
||||
|
||||
public CharsetEncoderUTF16BE(CharsetICU cs) {
|
||||
super(cs);
|
||||
implReset();
|
||||
}
|
||||
|
||||
protected void implReset() {
|
||||
super.implReset();
|
||||
fromUnicodeStatus = 0;
|
||||
writeBOM = false;
|
||||
}
|
||||
}
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new CharsetEncoderUTF16BE(this);
|
||||
}
|
||||
}
|
||||
/**
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2007, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.charset;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
|
||||
class CharsetUTF16BE extends CharsetUTF16 {
|
||||
public CharsetUTF16BE(String icuCanonicalName, String javaCanonicalName, String[] aliases){
|
||||
super(icuCanonicalName, javaCanonicalName, aliases);
|
||||
}
|
||||
class CharsetDecoderUTF16BE extends CharsetDecoderUTF16{
|
||||
|
||||
public CharsetDecoderUTF16BE(CharsetICU cs) {
|
||||
super(cs);
|
||||
}
|
||||
protected CoderResult decodeLoopImpl(ByteBuffer source, CharBuffer target, IntBuffer offsets, boolean flush){
|
||||
return decodeLoopUTF16BE(source, target, offsets, flush);
|
||||
}
|
||||
}
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new CharsetDecoderUTF16BE(this);
|
||||
}
|
||||
class CharsetEncoderUTF16BE extends CharsetEncoderUTF16{
|
||||
|
||||
public CharsetEncoderUTF16BE(CharsetICU cs) {
|
||||
super(cs);
|
||||
implReset();
|
||||
}
|
||||
|
||||
protected void implReset() {
|
||||
super.implReset();
|
||||
fromUnicodeStatus = 0;
|
||||
writeBOM = false;
|
||||
}
|
||||
}
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new CharsetEncoderUTF16BE(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,60 +1,60 @@
|
|||
/**
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2007, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.charset;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
|
||||
class CharsetUTF32BE extends CharsetUTF32 {
|
||||
public CharsetUTF32BE(String icuCanonicalName, String javaCanonicalName, String[] aliases){
|
||||
super(icuCanonicalName, javaCanonicalName, aliases);
|
||||
}
|
||||
class CharsetDecoderUTF32BE extends CharsetDecoderUTF32{
|
||||
|
||||
public CharsetDecoderUTF32BE(CharsetICU cs) {
|
||||
super(cs);
|
||||
mode=1;
|
||||
bom=1;
|
||||
}
|
||||
protected CoderResult decodeLoopImpl(ByteBuffer source, CharBuffer target, IntBuffer offsets, boolean flush){
|
||||
return decodeLoopUTF32BE(source, target, offsets, flush);
|
||||
}
|
||||
protected int getChar(byte[] bytes, int length){
|
||||
int i=0, ch=0;
|
||||
while (i<length){
|
||||
ch |= (bytes[i] & UConverterConstants.UNSIGNED_BYTE_MASK) << ((3-i) * 8);
|
||||
i++;
|
||||
}
|
||||
return ch;
|
||||
}
|
||||
}
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new CharsetDecoderUTF32BE(this);
|
||||
}
|
||||
class CharsetEncoderUTF32BE extends CharsetEncoderUTF32{
|
||||
|
||||
public CharsetEncoderUTF32BE(CharsetICU cs) {
|
||||
super(cs);
|
||||
implReset();
|
||||
}
|
||||
|
||||
protected void implReset() {
|
||||
super.implReset();
|
||||
fromUnicodeStatus = 0;
|
||||
writeBOM = false;
|
||||
}
|
||||
}
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new CharsetEncoderUTF32BE(this);
|
||||
}
|
||||
}
|
||||
/**
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2007, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.charset;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
|
||||
class CharsetUTF32BE extends CharsetUTF32 {
|
||||
public CharsetUTF32BE(String icuCanonicalName, String javaCanonicalName, String[] aliases){
|
||||
super(icuCanonicalName, javaCanonicalName, aliases);
|
||||
}
|
||||
class CharsetDecoderUTF32BE extends CharsetDecoderUTF32{
|
||||
|
||||
public CharsetDecoderUTF32BE(CharsetICU cs) {
|
||||
super(cs);
|
||||
mode=1;
|
||||
bom=1;
|
||||
}
|
||||
protected CoderResult decodeLoopImpl(ByteBuffer source, CharBuffer target, IntBuffer offsets, boolean flush){
|
||||
return decodeLoopUTF32BE(source, target, offsets, flush);
|
||||
}
|
||||
protected int getChar(byte[] bytes, int length){
|
||||
int i=0, ch=0;
|
||||
while (i<length){
|
||||
ch |= (bytes[i] & UConverterConstants.UNSIGNED_BYTE_MASK) << ((3-i) * 8);
|
||||
i++;
|
||||
}
|
||||
return ch;
|
||||
}
|
||||
}
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new CharsetDecoderUTF32BE(this);
|
||||
}
|
||||
class CharsetEncoderUTF32BE extends CharsetEncoderUTF32{
|
||||
|
||||
public CharsetEncoderUTF32BE(CharsetICU cs) {
|
||||
super(cs);
|
||||
implReset();
|
||||
}
|
||||
|
||||
protected void implReset() {
|
||||
super.implReset();
|
||||
fromUnicodeStatus = 0;
|
||||
writeBOM = false;
|
||||
}
|
||||
}
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new CharsetEncoderUTF32BE(this);
|
||||
}
|
||||
}
|
||||
|
|
0
src/com/ibm/icu/dev/data/rbbi/english.dict
Executable file → Normal file
0
src/com/ibm/icu/dev/data/rbbi/english.dict
Executable file → Normal file
0
src/com/ibm/icu/dev/data/rbbi/words.txt
Executable file → Normal file
0
src/com/ibm/icu/dev/data/rbbi/words.txt
Executable file → Normal file
0
src/com/ibm/icu/dev/data/thai6.ucs
Executable file → Normal file
0
src/com/ibm/icu/dev/data/thai6.ucs
Executable file → Normal file
0
src/com/ibm/icu/dev/data/unicode/CompositionExclusions.txt
Executable file → Normal file
0
src/com/ibm/icu/dev/data/unicode/CompositionExclusions.txt
Executable file → Normal file
0
src/com/ibm/icu/dev/data/unicode/SpecialCasing.txt
Executable file → Normal file
0
src/com/ibm/icu/dev/data/unicode/SpecialCasing.txt
Executable file → Normal file
0
src/com/ibm/icu/dev/data/unicode/UnicodeData.txt
Executable file → Normal file
0
src/com/ibm/icu/dev/data/unicode/UnicodeData.txt
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/calendar/CalendarApp.java
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/calendar/CalendarApp.java
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/calendar/CalendarCalc.java
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/calendar/CalendarCalc.java
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/calendar/CalendarFrame.java
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/calendar/CalendarFrame.java
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/calendar/CalendarPanel.java
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/calendar/CalendarPanel.java
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/calendar/package.html
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/calendar/package.html
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/holiday/HolidayBorderPanel.java
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/holiday/HolidayBorderPanel.java
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/holiday/HolidayCalendarDemo.java
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/holiday/HolidayCalendarDemo.java
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/holiday/package.html
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/holiday/package.html
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/impl/AppletFrame.java
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/impl/AppletFrame.java
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/impl/DemoApplet.java
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/impl/DemoApplet.java
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/impl/DemoTextBox.java
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/impl/DemoTextBox.java
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/impl/DemoUtility.java
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/impl/DemoUtility.java
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/impl/DumbTextComponent.java
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/impl/DumbTextComponent.java
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/impl/Selection.java
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/impl/Selection.java
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/impl/package.html
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/impl/package.html
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/translit/Demo.java
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/translit/Demo.java
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/translit/DemoApplet.java
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/translit/DemoApplet.java
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/translit/TransliteratingTextComponent.java
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/translit/TransliteratingTextComponent.java
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/translit/demo.html
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/translit/demo.html
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/translit/package.html
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/translit/package.html
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/translit/resources/Transliterator_Han_Pinyin.txt
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/translit/resources/Transliterator_Han_Pinyin.txt
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/translit/resources/Transliterator_Kanji_English.txt
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/translit/resources/Transliterator_Kanji_English.txt
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/translit/resources/Transliterator_Kanji_OnRomaji.txt
Executable file → Normal file
0
src/com/ibm/icu/dev/demo/translit/resources/Transliterator_Kanji_OnRomaji.txt
Executable file → Normal file
0
src/com/ibm/icu/dev/test/TestAll.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/TestAll.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/TestFmwk.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/TestFmwk.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/TestLog.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/TestLog.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/bigdec/DiagBigDecimal.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/bigdec/DiagBigDecimal.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/calendar/AstroTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/calendar/AstroTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/calendar/CalendarRegression.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/calendar/CalendarRegression.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/calendar/CalendarTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/calendar/CalendarTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/calendar/ChineseTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/calendar/ChineseTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/calendar/ChineseTestCase.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/calendar/ChineseTestCase.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/calendar/CompatibilityTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/calendar/CompatibilityTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/calendar/HebrewTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/calendar/HebrewTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/calendar/IBMCalendarTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/calendar/IBMCalendarTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/calendar/IslamicTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/calendar/IslamicTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/calendar/TestCase.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/calendar/TestCase.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/calendar/package.html
Executable file → Normal file
0
src/com/ibm/icu/dev/test/calendar/package.html
Executable file → Normal file
0
src/com/ibm/icu/dev/test/compression/DecompressionTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/compression/DecompressionTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/compression/ExhaustiveTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/compression/ExhaustiveTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/compression/package.html
Executable file → Normal file
0
src/com/ibm/icu/dev/test/compression/package.html
Executable file → Normal file
|
@ -1,231 +1,231 @@
|
|||
//##header J2SE15
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2007, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.dev.test.duration;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.MissingResourceException;
|
||||
|
||||
//#if defined(FOUNDATION10) || defined(J2SE13) || defined(J2SE14)
|
||||
//#else
|
||||
import javax.xml.datatype.DatatypeConfigurationException;
|
||||
import javax.xml.datatype.DatatypeFactory;
|
||||
import javax.xml.datatype.Duration;
|
||||
//#endif
|
||||
|
||||
import com.ibm.icu.dev.test.TestFmwk;
|
||||
import com.ibm.icu.text.DurationFormat;
|
||||
import com.ibm.icu.util.ULocale;
|
||||
|
||||
/**
|
||||
* @author srl
|
||||
*
|
||||
*/
|
||||
public class ICUDurationTest extends TestFmwk {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public ICUDurationTest() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
new ICUDurationTest().run(args);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Basic test
|
||||
*/
|
||||
public void TestBasics() {
|
||||
DurationFormat df;
|
||||
String expect;
|
||||
String formatted;
|
||||
|
||||
df = DurationFormat.getInstance(new ULocale("it"));
|
||||
formatted = df.formatDurationFromNow(4096);
|
||||
expect = "fra quattro secondi";
|
||||
if(!expect.equals(formatted)) {
|
||||
errln("Expected " + expect + " but got " + formatted);
|
||||
} else {
|
||||
logln("format duration -> " + formatted);
|
||||
}
|
||||
|
||||
formatted = df.formatDurationFromNowTo(new Date(0));
|
||||
expect = "fra 37 anni"; // will break next year.
|
||||
if(!expect.equals(formatted)) {
|
||||
errln("Expected " + expect + " but got " + formatted);
|
||||
} else {
|
||||
logln("format date -> " + formatted);
|
||||
}
|
||||
|
||||
formatted = df.formatDurationFrom(1000*3600*24, new Date(0).getTime());
|
||||
expect = "fra un giorno";
|
||||
if(!expect.equals(formatted)) {
|
||||
errln("Expected " + expect + " but got " + formatted);
|
||||
} else {
|
||||
logln("format date from -> " + formatted);
|
||||
}
|
||||
|
||||
formatted = df.format(new Long(1000*3600*24*2));
|
||||
expect = "fra due giorni";
|
||||
if(!expect.equals(formatted)) {
|
||||
errln("Expected " + expect + " but got " + formatted);
|
||||
} else {
|
||||
logln("format long obj -> " + formatted);
|
||||
}
|
||||
}
|
||||
|
||||
//#if defined(FOUNDATION10) || defined(J2SE13) || defined(J2SE14)
|
||||
//#else
|
||||
public void TestSimpleXMLDuration() {
|
||||
DatatypeFactory factory = null;
|
||||
try {
|
||||
factory = DatatypeFactory.newInstance();
|
||||
} catch (DatatypeConfigurationException e) {
|
||||
errln("Error instantiating XML DatatypeFactory.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Duration d;
|
||||
DurationFormat df;
|
||||
String out;
|
||||
String expected;
|
||||
|
||||
|
||||
// test 1
|
||||
d = factory.newDuration("PT2H46M40S");
|
||||
df = DurationFormat.getInstance(new ULocale("en"));
|
||||
expected = "2 hours, 46 minutes, and 40 seconds";
|
||||
out = df.format(d);
|
||||
if(out.equals(expected)) {
|
||||
logln("out=expected: " + expected + " from " + d);
|
||||
} else {
|
||||
errln("FAIL: got " + out + " wanted " + expected + " from " + d);
|
||||
}
|
||||
|
||||
// test 2
|
||||
d = factory.newDuration(10000);
|
||||
df = DurationFormat.getInstance(new ULocale("en"));
|
||||
expected = "10 seconds";
|
||||
out = df.format(d);
|
||||
if(out.equals(expected)) {
|
||||
logln("out=expected: " + expected + " from " + d);
|
||||
} else {
|
||||
errln("FAIL: got " + out + " wanted " + expected + " from " + d);
|
||||
}
|
||||
// test 3
|
||||
d = factory.newDuration("P0DT0H0M10.0S");
|
||||
df = DurationFormat.getInstance(new ULocale("en"));
|
||||
expected = "10 seconds";
|
||||
out = df.format(d);
|
||||
if(out.equals(expected)) {
|
||||
logln("out=expected: " + expected + " from " + d);
|
||||
} else {
|
||||
errln("FAIL: got " + out + " wanted " + expected + " from " + d);
|
||||
}
|
||||
// test 4
|
||||
d = factory.newDuration(86400000);
|
||||
df = DurationFormat.getInstance(new ULocale("en"));
|
||||
expected = "1 day, 0 hours, 0 minutes, and 0 seconds";
|
||||
out = df.format(d);
|
||||
if(out.equals(expected)) {
|
||||
logln("out=expected: " + expected + " from " + d);
|
||||
} else {
|
||||
errln("FAIL: got " + out + " wanted " + expected + " from " + d);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void TestXMLDuration() {
|
||||
DatatypeFactory factory = null;
|
||||
try {
|
||||
factory = DatatypeFactory.newInstance();
|
||||
} catch (DatatypeConfigurationException e) {
|
||||
errln("Error instantiating XML DatatypeFactory.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
String cases[] = {
|
||||
"en", "PT10.00099S", "10 seconds",
|
||||
"en", "#10000", "10 seconds",
|
||||
"en", "-PT10.00099S", "10 seconds",
|
||||
"en", "#-10000", "10 seconds",
|
||||
|
||||
// from BD req's
|
||||
"en", "PT2H46M40S", "2 hours, 46 minutes, and 40 seconds",
|
||||
"it", "PT2H46M40S", "due ore, 46 minuti e 40 secondi",
|
||||
|
||||
// more cases
|
||||
"en", "PT10S", "10 seconds",
|
||||
"en", "PT88M70S", "88 minutes and 70 seconds",
|
||||
"en", "PT10.100S", "10 seconds and 100 milliseconds",
|
||||
"en", "-PT10S", "10 seconds",
|
||||
"en", "PT0H5M0S", "5 minutes and 0 seconds"
|
||||
};
|
||||
|
||||
for(int n=0;n<cases.length;n+=3) {
|
||||
String loc = cases[n+0];
|
||||
String from = cases[n+1];
|
||||
String to = cases[n+2];
|
||||
|
||||
ULocale locale = new ULocale(loc);
|
||||
Duration d;
|
||||
if(from.startsWith("#")) {
|
||||
d = factory.newDuration(Long.parseLong(from.substring(1)));
|
||||
} else {
|
||||
d = factory.newDuration(from);
|
||||
}
|
||||
|
||||
DurationFormat df = DurationFormat.getInstance(locale);
|
||||
String output = df.format(d);
|
||||
|
||||
if(output.equals(to)) {
|
||||
logln("SUCCESS: locale: " + loc + ", from " + from + " ["+d.toString()+"] " +" to " + to + "= " + output);
|
||||
} else {
|
||||
logln("FAIL: locale: " + loc + ", from " + from + " ["+d.toString()+"] " +": expected " + to + " got " + output);
|
||||
}
|
||||
}
|
||||
}
|
||||
//#endif
|
||||
|
||||
|
||||
public void TestBadObjectError() {
|
||||
Runtime r = Runtime.getRuntime();
|
||||
DurationFormat df = DurationFormat.getInstance(new ULocale("en"));
|
||||
String output = null;
|
||||
try {
|
||||
output = df.format(r);
|
||||
errln("FAIL: did NOT get IllegalArgumentException! Should have. Formatted Runtime as " + output + " ???");
|
||||
} catch (IllegalArgumentException iae) {
|
||||
logln("PASS: expected: Caught iae: " + iae.toString() );
|
||||
}
|
||||
// try a second time, because it is a different code path for java < 1.5
|
||||
try {
|
||||
output = df.format(r);
|
||||
errln("FAIL: [#2] did NOT get IllegalArgumentException! Should have. Formatted Runtime as " + output + " ???");
|
||||
} catch (IllegalArgumentException iae) {
|
||||
logln("PASS: [#2] expected: Caught iae: " + iae.toString() );
|
||||
}
|
||||
}
|
||||
|
||||
public void TestBadLocaleError() {
|
||||
try {
|
||||
DurationFormat df = DurationFormat.getInstance(new ULocale("und"));
|
||||
df.format(new Date());
|
||||
logln("Should have thrown err.");
|
||||
errln("failed, should have thrown err.");
|
||||
} catch(MissingResourceException mre) {
|
||||
logln("PASS: caught missing resource exception on locale 'und'");
|
||||
logln(mre.toString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//##header J2SE15
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2007, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.dev.test.duration;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.MissingResourceException;
|
||||
|
||||
//#if defined(FOUNDATION10) || defined(J2SE13) || defined(J2SE14)
|
||||
//#else
|
||||
import javax.xml.datatype.DatatypeConfigurationException;
|
||||
import javax.xml.datatype.DatatypeFactory;
|
||||
import javax.xml.datatype.Duration;
|
||||
//#endif
|
||||
|
||||
import com.ibm.icu.dev.test.TestFmwk;
|
||||
import com.ibm.icu.text.DurationFormat;
|
||||
import com.ibm.icu.util.ULocale;
|
||||
|
||||
/**
|
||||
* @author srl
|
||||
*
|
||||
*/
|
||||
public class ICUDurationTest extends TestFmwk {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public ICUDurationTest() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
new ICUDurationTest().run(args);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Basic test
|
||||
*/
|
||||
public void TestBasics() {
|
||||
DurationFormat df;
|
||||
String expect;
|
||||
String formatted;
|
||||
|
||||
df = DurationFormat.getInstance(new ULocale("it"));
|
||||
formatted = df.formatDurationFromNow(4096);
|
||||
expect = "fra quattro secondi";
|
||||
if(!expect.equals(formatted)) {
|
||||
errln("Expected " + expect + " but got " + formatted);
|
||||
} else {
|
||||
logln("format duration -> " + formatted);
|
||||
}
|
||||
|
||||
formatted = df.formatDurationFromNowTo(new Date(0));
|
||||
expect = "fra 37 anni"; // will break next year.
|
||||
if(!expect.equals(formatted)) {
|
||||
errln("Expected " + expect + " but got " + formatted);
|
||||
} else {
|
||||
logln("format date -> " + formatted);
|
||||
}
|
||||
|
||||
formatted = df.formatDurationFrom(1000*3600*24, new Date(0).getTime());
|
||||
expect = "fra un giorno";
|
||||
if(!expect.equals(formatted)) {
|
||||
errln("Expected " + expect + " but got " + formatted);
|
||||
} else {
|
||||
logln("format date from -> " + formatted);
|
||||
}
|
||||
|
||||
formatted = df.format(new Long(1000*3600*24*2));
|
||||
expect = "fra due giorni";
|
||||
if(!expect.equals(formatted)) {
|
||||
errln("Expected " + expect + " but got " + formatted);
|
||||
} else {
|
||||
logln("format long obj -> " + formatted);
|
||||
}
|
||||
}
|
||||
|
||||
//#if defined(FOUNDATION10) || defined(J2SE13) || defined(J2SE14)
|
||||
//#else
|
||||
public void TestSimpleXMLDuration() {
|
||||
DatatypeFactory factory = null;
|
||||
try {
|
||||
factory = DatatypeFactory.newInstance();
|
||||
} catch (DatatypeConfigurationException e) {
|
||||
errln("Error instantiating XML DatatypeFactory.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Duration d;
|
||||
DurationFormat df;
|
||||
String out;
|
||||
String expected;
|
||||
|
||||
|
||||
// test 1
|
||||
d = factory.newDuration("PT2H46M40S");
|
||||
df = DurationFormat.getInstance(new ULocale("en"));
|
||||
expected = "2 hours, 46 minutes, and 40 seconds";
|
||||
out = df.format(d);
|
||||
if(out.equals(expected)) {
|
||||
logln("out=expected: " + expected + " from " + d);
|
||||
} else {
|
||||
errln("FAIL: got " + out + " wanted " + expected + " from " + d);
|
||||
}
|
||||
|
||||
// test 2
|
||||
d = factory.newDuration(10000);
|
||||
df = DurationFormat.getInstance(new ULocale("en"));
|
||||
expected = "10 seconds";
|
||||
out = df.format(d);
|
||||
if(out.equals(expected)) {
|
||||
logln("out=expected: " + expected + " from " + d);
|
||||
} else {
|
||||
errln("FAIL: got " + out + " wanted " + expected + " from " + d);
|
||||
}
|
||||
// test 3
|
||||
d = factory.newDuration("P0DT0H0M10.0S");
|
||||
df = DurationFormat.getInstance(new ULocale("en"));
|
||||
expected = "10 seconds";
|
||||
out = df.format(d);
|
||||
if(out.equals(expected)) {
|
||||
logln("out=expected: " + expected + " from " + d);
|
||||
} else {
|
||||
errln("FAIL: got " + out + " wanted " + expected + " from " + d);
|
||||
}
|
||||
// test 4
|
||||
d = factory.newDuration(86400000);
|
||||
df = DurationFormat.getInstance(new ULocale("en"));
|
||||
expected = "1 day, 0 hours, 0 minutes, and 0 seconds";
|
||||
out = df.format(d);
|
||||
if(out.equals(expected)) {
|
||||
logln("out=expected: " + expected + " from " + d);
|
||||
} else {
|
||||
errln("FAIL: got " + out + " wanted " + expected + " from " + d);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void TestXMLDuration() {
|
||||
DatatypeFactory factory = null;
|
||||
try {
|
||||
factory = DatatypeFactory.newInstance();
|
||||
} catch (DatatypeConfigurationException e) {
|
||||
errln("Error instantiating XML DatatypeFactory.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
String cases[] = {
|
||||
"en", "PT10.00099S", "10 seconds",
|
||||
"en", "#10000", "10 seconds",
|
||||
"en", "-PT10.00099S", "10 seconds",
|
||||
"en", "#-10000", "10 seconds",
|
||||
|
||||
// from BD req's
|
||||
"en", "PT2H46M40S", "2 hours, 46 minutes, and 40 seconds",
|
||||
"it", "PT2H46M40S", "due ore, 46 minuti e 40 secondi",
|
||||
|
||||
// more cases
|
||||
"en", "PT10S", "10 seconds",
|
||||
"en", "PT88M70S", "88 minutes and 70 seconds",
|
||||
"en", "PT10.100S", "10 seconds and 100 milliseconds",
|
||||
"en", "-PT10S", "10 seconds",
|
||||
"en", "PT0H5M0S", "5 minutes and 0 seconds"
|
||||
};
|
||||
|
||||
for(int n=0;n<cases.length;n+=3) {
|
||||
String loc = cases[n+0];
|
||||
String from = cases[n+1];
|
||||
String to = cases[n+2];
|
||||
|
||||
ULocale locale = new ULocale(loc);
|
||||
Duration d;
|
||||
if(from.startsWith("#")) {
|
||||
d = factory.newDuration(Long.parseLong(from.substring(1)));
|
||||
} else {
|
||||
d = factory.newDuration(from);
|
||||
}
|
||||
|
||||
DurationFormat df = DurationFormat.getInstance(locale);
|
||||
String output = df.format(d);
|
||||
|
||||
if(output.equals(to)) {
|
||||
logln("SUCCESS: locale: " + loc + ", from " + from + " ["+d.toString()+"] " +" to " + to + "= " + output);
|
||||
} else {
|
||||
logln("FAIL: locale: " + loc + ", from " + from + " ["+d.toString()+"] " +": expected " + to + " got " + output);
|
||||
}
|
||||
}
|
||||
}
|
||||
//#endif
|
||||
|
||||
|
||||
public void TestBadObjectError() {
|
||||
Runtime r = Runtime.getRuntime();
|
||||
DurationFormat df = DurationFormat.getInstance(new ULocale("en"));
|
||||
String output = null;
|
||||
try {
|
||||
output = df.format(r);
|
||||
errln("FAIL: did NOT get IllegalArgumentException! Should have. Formatted Runtime as " + output + " ???");
|
||||
} catch (IllegalArgumentException iae) {
|
||||
logln("PASS: expected: Caught iae: " + iae.toString() );
|
||||
}
|
||||
// try a second time, because it is a different code path for java < 1.5
|
||||
try {
|
||||
output = df.format(r);
|
||||
errln("FAIL: [#2] did NOT get IllegalArgumentException! Should have. Formatted Runtime as " + output + " ???");
|
||||
} catch (IllegalArgumentException iae) {
|
||||
logln("PASS: [#2] expected: Caught iae: " + iae.toString() );
|
||||
}
|
||||
}
|
||||
|
||||
public void TestBadLocaleError() {
|
||||
try {
|
||||
DurationFormat df = DurationFormat.getInstance(new ULocale("und"));
|
||||
df.format(new Date());
|
||||
logln("Should have thrown err.");
|
||||
errln("failed, should have thrown err.");
|
||||
} catch(MissingResourceException mre) {
|
||||
logln("PASS: caught missing resource exception on locale 'und'");
|
||||
logln(mre.toString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
0
src/com/ibm/icu/dev/test/format/BigNumberFormatTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/BigNumberFormatTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/DateFormatMiscTests.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/DateFormatMiscTests.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/DateFormatRegressionTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/DateFormatRegressionTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/DateFormatRegressionTestJ.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/DateFormatRegressionTestJ.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/DateFormatRoundTripTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/DateFormatRoundTripTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/DateFormatTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/DateFormatTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/IntlTestDateFormat.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/IntlTestDateFormat.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/IntlTestDateFormatAPI.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/IntlTestDateFormatAPI.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/IntlTestDateFormatAPIC.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/IntlTestDateFormatAPIC.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/IntlTestDateFormatSymbols.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/IntlTestDateFormatSymbols.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/IntlTestDecimalFormatAPI.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/IntlTestDecimalFormatAPI.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/IntlTestDecimalFormatAPIC.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/IntlTestDecimalFormatAPIC.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/IntlTestDecimalFormatSymbols.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/IntlTestDecimalFormatSymbols.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/IntlTestDecimalFormatSymbolsC.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/IntlTestDecimalFormatSymbolsC.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/IntlTestNumberFormat.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/IntlTestNumberFormat.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/IntlTestNumberFormatAPI.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/IntlTestNumberFormatAPI.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/IntlTestSimpleDateFormatAPI.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/IntlTestSimpleDateFormatAPI.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/NumberFormatRegressionTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/NumberFormatRegressionTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/NumberFormatRoundTripTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/NumberFormatRoundTripTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/NumberFormatSerialTestData.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/NumberFormatSerialTestData.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/NumberFormatTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/NumberFormatTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/NumberRegression.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/NumberRegression.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/RbnfRoundTripTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/RbnfRoundTripTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/RbnfTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/RbnfTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/WriteNumberFormatSerialTestData.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/format/WriteNumberFormatSerialTestData.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/lang/TestUScript.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/lang/TestUScript.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/lang/UCharacterCompare.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/lang/UCharacterCompare.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/lang/UCharacterTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/lang/UCharacterTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/lang/UTF16Test.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/lang/UTF16Test.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/normalizer/BasicTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/normalizer/BasicTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/normalizer/ConformanceTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/normalizer/ConformanceTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/normalizer/TestCanonicalIterator.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/normalizer/TestCanonicalIterator.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/normalizer/package.html
Executable file → Normal file
0
src/com/ibm/icu/dev/test/normalizer/package.html
Executable file → Normal file
0
src/com/ibm/icu/dev/test/package.html
Executable file → Normal file
0
src/com/ibm/icu/dev/test/package.html
Executable file → Normal file
|
@ -1,115 +1,115 @@
|
|||
/*
|
||||
* ******************************************************************************
|
||||
* Copyright (C) 2007, International Business Machines Corporation and others. *
|
||||
* All Rights Reserved. *
|
||||
* ******************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.dev.test.perf;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* @author ajmacher
|
||||
*/
|
||||
public class DateFormatPerformanceTest extends PerfTest {
|
||||
private String pattern;
|
||||
|
||||
private String dateString;
|
||||
|
||||
private Date date;
|
||||
|
||||
private com.ibm.icu.text.SimpleDateFormat[] icuDateFormat;
|
||||
|
||||
private java.text.SimpleDateFormat[] jdkDateFormat;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
new DateFormatPerformanceTest().run(args);
|
||||
}
|
||||
|
||||
protected void setup(String[] args) {
|
||||
try {
|
||||
if (args.length == 0 || args.length > 2) {
|
||||
throw new UsageException();
|
||||
}
|
||||
|
||||
pattern = args[0];
|
||||
|
||||
if (locale == null)
|
||||
locale = Locale.getDefault();
|
||||
|
||||
icuDateFormat = new com.ibm.icu.text.SimpleDateFormat[threads];
|
||||
jdkDateFormat = new java.text.SimpleDateFormat[threads];
|
||||
for (int i = 0; i < threads; i++) {
|
||||
icuDateFormat[i] = new com.ibm.icu.text.SimpleDateFormat(pattern, locale);
|
||||
jdkDateFormat[i] = new java.text.SimpleDateFormat(pattern, locale);
|
||||
}
|
||||
|
||||
if (args.length == 2) {
|
||||
dateString = args[1];
|
||||
date = icuDateFormat[0].parse(dateString);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
PerfTest.Function TestICUConstruction() {
|
||||
return new PerfTest.Function() {
|
||||
public void call() {
|
||||
new com.ibm.icu.text.SimpleDateFormat(pattern, locale);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
PerfTest.Function TestJDKConstruction() {
|
||||
return new PerfTest.Function() {
|
||||
public void call() {
|
||||
new java.text.SimpleDateFormat(pattern, locale);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
PerfTest.Function TestICUParse() {
|
||||
return new PerfTest.Function() {
|
||||
public void call(int id) {
|
||||
try {
|
||||
icuDateFormat[id].parse(dateString);
|
||||
} catch (ParseException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
PerfTest.Function TestJDKParse() {
|
||||
return new PerfTest.Function() {
|
||||
public void call(int id) {
|
||||
try {
|
||||
jdkDateFormat[id].parse(dateString);
|
||||
} catch (ParseException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
PerfTest.Function TestICUFormat() {
|
||||
return new PerfTest.Function() {
|
||||
public void call(int id) {
|
||||
icuDateFormat[id].format(date);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
PerfTest.Function TestJDKFormat() {
|
||||
return new PerfTest.Function() {
|
||||
public void call(int id) {
|
||||
jdkDateFormat[id].format(date);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
/*
|
||||
* ******************************************************************************
|
||||
* Copyright (C) 2007, International Business Machines Corporation and others. *
|
||||
* All Rights Reserved. *
|
||||
* ******************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.dev.test.perf;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* @author ajmacher
|
||||
*/
|
||||
public class DateFormatPerformanceTest extends PerfTest {
|
||||
private String pattern;
|
||||
|
||||
private String dateString;
|
||||
|
||||
private Date date;
|
||||
|
||||
private com.ibm.icu.text.SimpleDateFormat[] icuDateFormat;
|
||||
|
||||
private java.text.SimpleDateFormat[] jdkDateFormat;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
new DateFormatPerformanceTest().run(args);
|
||||
}
|
||||
|
||||
protected void setup(String[] args) {
|
||||
try {
|
||||
if (args.length == 0 || args.length > 2) {
|
||||
throw new UsageException();
|
||||
}
|
||||
|
||||
pattern = args[0];
|
||||
|
||||
if (locale == null)
|
||||
locale = Locale.getDefault();
|
||||
|
||||
icuDateFormat = new com.ibm.icu.text.SimpleDateFormat[threads];
|
||||
jdkDateFormat = new java.text.SimpleDateFormat[threads];
|
||||
for (int i = 0; i < threads; i++) {
|
||||
icuDateFormat[i] = new com.ibm.icu.text.SimpleDateFormat(pattern, locale);
|
||||
jdkDateFormat[i] = new java.text.SimpleDateFormat(pattern, locale);
|
||||
}
|
||||
|
||||
if (args.length == 2) {
|
||||
dateString = args[1];
|
||||
date = icuDateFormat[0].parse(dateString);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
PerfTest.Function TestICUConstruction() {
|
||||
return new PerfTest.Function() {
|
||||
public void call() {
|
||||
new com.ibm.icu.text.SimpleDateFormat(pattern, locale);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
PerfTest.Function TestJDKConstruction() {
|
||||
return new PerfTest.Function() {
|
||||
public void call() {
|
||||
new java.text.SimpleDateFormat(pattern, locale);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
PerfTest.Function TestICUParse() {
|
||||
return new PerfTest.Function() {
|
||||
public void call(int id) {
|
||||
try {
|
||||
icuDateFormat[id].parse(dateString);
|
||||
} catch (ParseException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
PerfTest.Function TestJDKParse() {
|
||||
return new PerfTest.Function() {
|
||||
public void call(int id) {
|
||||
try {
|
||||
jdkDateFormat[id].parse(dateString);
|
||||
} catch (ParseException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
PerfTest.Function TestICUFormat() {
|
||||
return new PerfTest.Function() {
|
||||
public void call(int id) {
|
||||
icuDateFormat[id].format(date);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
PerfTest.Function TestJDKFormat() {
|
||||
return new PerfTest.Function() {
|
||||
public void call(int id) {
|
||||
jdkDateFormat[id].format(date);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,119 +1,119 @@
|
|||
/*
|
||||
* ******************************************************************************
|
||||
* Copyright (C) 2007, International Business Machines Corporation and * others.
|
||||
* All Rights Reserved. *
|
||||
* ******************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.dev.test.perf;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* @author ajmacher
|
||||
*/
|
||||
public class DecimalFormatPerformanceTest extends PerfTest {
|
||||
String pattern;
|
||||
|
||||
String decimalAsString;
|
||||
|
||||
Number decimalAsNumber;
|
||||
|
||||
com.ibm.icu.text.DecimalFormat[] icuDecimalFormat;
|
||||
|
||||
java.text.DecimalFormat[] javaDecimalFormat;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
new DecimalFormatPerformanceTest().run(args);
|
||||
}
|
||||
|
||||
protected void setup(String[] args) {
|
||||
try {
|
||||
if (args.length == 0 || args.length > 2) {
|
||||
throw new UsageException();
|
||||
}
|
||||
|
||||
pattern = args[0];
|
||||
|
||||
if (locale == null)
|
||||
locale = Locale.getDefault();
|
||||
|
||||
icuDecimalFormat = new com.ibm.icu.text.DecimalFormat[threads];
|
||||
javaDecimalFormat = new java.text.DecimalFormat[threads];
|
||||
for (int i = 0; i < threads; i++) {
|
||||
icuDecimalFormat[i] = new com.ibm.icu.text.DecimalFormat(pattern,
|
||||
new com.ibm.icu.text.DecimalFormatSymbols(locale));
|
||||
javaDecimalFormat[i] = new java.text.DecimalFormat(pattern,
|
||||
new java.text.DecimalFormatSymbols(locale));
|
||||
}
|
||||
|
||||
if (args.length == 2) {
|
||||
decimalAsString = args[1];
|
||||
decimalAsNumber = icuDecimalFormat[0].parse(decimalAsString);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
PerfTest.Function TestICUConstruction() {
|
||||
return new PerfTest.Function() {
|
||||
public void call() {
|
||||
new com.ibm.icu.text.DecimalFormat(pattern,
|
||||
new com.ibm.icu.text.DecimalFormatSymbols(locale));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
PerfTest.Function TestJDKConstruction() {
|
||||
return new PerfTest.Function() {
|
||||
public void call() {
|
||||
new java.text.DecimalFormat(pattern, new java.text.DecimalFormatSymbols(locale));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
PerfTest.Function TestICUParse() {
|
||||
return new PerfTest.Function() {
|
||||
public void call(int id) {
|
||||
try {
|
||||
icuDecimalFormat[id].parse(decimalAsString);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
PerfTest.Function TestJDKParse() {
|
||||
return new PerfTest.Function() {
|
||||
public void call(int id) {
|
||||
try {
|
||||
javaDecimalFormat[id].parse(decimalAsString);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
PerfTest.Function TestICUFormat() {
|
||||
return new PerfTest.Function() {
|
||||
public void call(int id) {
|
||||
icuDecimalFormat[id].format(decimalAsNumber);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
PerfTest.Function TestJDKFormat() {
|
||||
return new PerfTest.Function() {
|
||||
public void call(int id) {
|
||||
javaDecimalFormat[id].format(decimalAsNumber);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
/*
|
||||
* ******************************************************************************
|
||||
* Copyright (C) 2007, International Business Machines Corporation and * others.
|
||||
* All Rights Reserved. *
|
||||
* ******************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.dev.test.perf;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* @author ajmacher
|
||||
*/
|
||||
public class DecimalFormatPerformanceTest extends PerfTest {
|
||||
String pattern;
|
||||
|
||||
String decimalAsString;
|
||||
|
||||
Number decimalAsNumber;
|
||||
|
||||
com.ibm.icu.text.DecimalFormat[] icuDecimalFormat;
|
||||
|
||||
java.text.DecimalFormat[] javaDecimalFormat;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
new DecimalFormatPerformanceTest().run(args);
|
||||
}
|
||||
|
||||
protected void setup(String[] args) {
|
||||
try {
|
||||
if (args.length == 0 || args.length > 2) {
|
||||
throw new UsageException();
|
||||
}
|
||||
|
||||
pattern = args[0];
|
||||
|
||||
if (locale == null)
|
||||
locale = Locale.getDefault();
|
||||
|
||||
icuDecimalFormat = new com.ibm.icu.text.DecimalFormat[threads];
|
||||
javaDecimalFormat = new java.text.DecimalFormat[threads];
|
||||
for (int i = 0; i < threads; i++) {
|
||||
icuDecimalFormat[i] = new com.ibm.icu.text.DecimalFormat(pattern,
|
||||
new com.ibm.icu.text.DecimalFormatSymbols(locale));
|
||||
javaDecimalFormat[i] = new java.text.DecimalFormat(pattern,
|
||||
new java.text.DecimalFormatSymbols(locale));
|
||||
}
|
||||
|
||||
if (args.length == 2) {
|
||||
decimalAsString = args[1];
|
||||
decimalAsNumber = icuDecimalFormat[0].parse(decimalAsString);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
PerfTest.Function TestICUConstruction() {
|
||||
return new PerfTest.Function() {
|
||||
public void call() {
|
||||
new com.ibm.icu.text.DecimalFormat(pattern,
|
||||
new com.ibm.icu.text.DecimalFormatSymbols(locale));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
PerfTest.Function TestJDKConstruction() {
|
||||
return new PerfTest.Function() {
|
||||
public void call() {
|
||||
new java.text.DecimalFormat(pattern, new java.text.DecimalFormatSymbols(locale));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
PerfTest.Function TestICUParse() {
|
||||
return new PerfTest.Function() {
|
||||
public void call(int id) {
|
||||
try {
|
||||
icuDecimalFormat[id].parse(decimalAsString);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
PerfTest.Function TestJDKParse() {
|
||||
return new PerfTest.Function() {
|
||||
public void call(int id) {
|
||||
try {
|
||||
javaDecimalFormat[id].parse(decimalAsString);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
PerfTest.Function TestICUFormat() {
|
||||
return new PerfTest.Function() {
|
||||
public void call(int id) {
|
||||
icuDecimalFormat[id].format(decimalAsNumber);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
PerfTest.Function TestJDKFormat() {
|
||||
return new PerfTest.Function() {
|
||||
public void call(int id) {
|
||||
javaDecimalFormat[id].format(decimalAsNumber);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
1020
src/com/ibm/icu/dev/test/perf/converterperf.pl
Normal file → Executable file
1020
src/com/ibm/icu/dev/test/perf/converterperf.pl
Normal file → Executable file
File diff suppressed because it is too large
Load diff
992
src/com/ibm/icu/dev/test/perf/dateformatperf.pl
Normal file → Executable file
992
src/com/ibm/icu/dev/test/perf/dateformatperf.pl
Normal file → Executable file
|
@ -1,496 +1,496 @@
|
|||
#!/usr/local/bin/perl
|
||||
# *******************************************************************************
|
||||
# * Copyright (C) 2002-2007 International Business Machines Corporation and *
|
||||
# * others. All Rights Reserved. *
|
||||
# *******************************************************************************
|
||||
|
||||
use strict;
|
||||
|
||||
# Assume we are running within the icu4j root directory
|
||||
use lib 'src/com/ibm/icu/dev/test/perf';
|
||||
use Dataset;
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Test class
|
||||
my $TESTCLASS = 'com.ibm.icu.dev.test.perf.DateFormatPerformanceTest';
|
||||
|
||||
# Methods to be tested. Each pair represents a test method and
|
||||
# a baseline method which is used for comparison.
|
||||
my @METHODS = (
|
||||
['TestJDKConstruction', 'TestICUConstruction'],
|
||||
['TestJDKParse', 'TestICUParse'],
|
||||
['TestJDKFormat', 'TestICUFormat']
|
||||
);
|
||||
# Patterns which define the set of characters used for testing.
|
||||
my @OPTIONS = (
|
||||
# locale pattern date string
|
||||
[ "en_US", "dddd MMM yyyy", "15 Jan 2007"],
|
||||
[ "sw_KE", "dddd MMM yyyy", "15 Jan 2007"],
|
||||
[ "en_US", "HH:mm", "13:13"],
|
||||
[ "en_US", "HH:mm zzzz", "13:13 Pacific Standard Time"],
|
||||
[ "en_US", "HH:mm z", "13:13 PST"],
|
||||
[ "en_US", "HH:mm Z", "13:13 -0800"],
|
||||
);
|
||||
|
||||
my $THREADS; # number of threads (input from command-line args)
|
||||
my $CALIBRATE = 2; # duration in seconds for initial calibration
|
||||
my $DURATION = 10; # duration in seconds for each pass
|
||||
my $NUMPASSES = 4; # number of passes. If > 1 then the first pass
|
||||
# is discarded as a JIT warm-up pass.
|
||||
|
||||
my $TABLEATTR = 'BORDER="1" CELLPADDING="4" CELLSPACING="0"';
|
||||
|
||||
my $PLUS_MINUS = "±";
|
||||
|
||||
if ($NUMPASSES < 3) {
|
||||
die "Need at least 3 passes. One is discarded (JIT warmup) and need two to have 1 degree of freedom (t distribution).";
|
||||
}
|
||||
|
||||
my $OUT; # see out()
|
||||
|
||||
# run all tests with the specified number of threads from command-line input
|
||||
# (if there is no arguments, use $THREADS = 1)
|
||||
foreach my $arg ($#ARGV >= 0 ? @ARGV : "1") {
|
||||
$THREADS = $arg;
|
||||
main();
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# ...
|
||||
sub main {
|
||||
my $date = localtime;
|
||||
my $threads = ($THREADS > 1) ? "($THREADS threads)" : "";
|
||||
my $title = "ICU4J Performance Test $threads $date";
|
||||
|
||||
my $html = $date;
|
||||
$html =~ s/://g; # ':' illegal
|
||||
$html =~ s/\s*\d+$//; # delete year
|
||||
$html =~ s/^\w+\s*//; # delete dow
|
||||
$html = "perf $html.html";
|
||||
|
||||
open(HTML,">$html") or die "Can't write to $html: $!";
|
||||
|
||||
print HTML <<EOF;
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>$title</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
EOF
|
||||
print HTML "<H1>$title</H1>\n";
|
||||
|
||||
print HTML "<H2>$TESTCLASS</H2>\n";
|
||||
|
||||
my $raw = "";
|
||||
|
||||
for my $methodPair (@METHODS) {
|
||||
|
||||
my $testMethod = $methodPair->[0];
|
||||
my $baselineMethod = $methodPair->[1];
|
||||
|
||||
print HTML "<P><TABLE $TABLEATTR><TR><TD>\n";
|
||||
print HTML "<P><B>$testMethod vs. $baselineMethod</B></P>\n";
|
||||
|
||||
print HTML "<P><TABLE $TABLEATTR BGCOLOR=\"#CCFFFF\">\n";
|
||||
print HTML "<TR><TD>Options</TD><TD>$testMethod</TD>";
|
||||
print HTML "<TD>$baselineMethod</TD><TD>Ratio</TD></TR>\n";
|
||||
|
||||
$OUT = '';
|
||||
|
||||
for my $pat (@OPTIONS) {
|
||||
print HTML "<TR><TD>@$pat[0], \"@$pat[1]\", \"@$pat[2]\"</TD>\n";
|
||||
|
||||
out("<P><TABLE $TABLEATTR WIDTH=\"100%\">");
|
||||
|
||||
# measure the test method
|
||||
out("<TR><TD>");
|
||||
print "\n$testMethod [@$pat]\n";
|
||||
my $t = measure2($testMethod, $pat, -$DURATION);
|
||||
out("</TD></TR>");
|
||||
print HTML "<TD>", formatSeconds(4, $t->getMean(), $t->getError);
|
||||
print HTML "/event</TD>\n";
|
||||
|
||||
# measure baseline method
|
||||
out("<TR><TD>");
|
||||
print "\n$baselineMethod [@$pat]\n";
|
||||
my $b = measure2($baselineMethod, $pat, -$DURATION);
|
||||
out("</TD></TR>");
|
||||
print HTML "<TD>", formatSeconds(4, $b->getMean(), $t->getError);
|
||||
print HTML "/event</TD>\n";
|
||||
|
||||
out("</TABLE></P>");
|
||||
|
||||
# output ratio
|
||||
my $r = $t->divide($b);
|
||||
my $mean = $r->getMean() - 1;
|
||||
my $color = $mean < 0 ? "RED" : "BLACK";
|
||||
print HTML "<TD><B><FONT COLOR=\"$color\">", formatPercent(3, $mean, $r->getError);
|
||||
print HTML "</FONT></B></TD></TR>\n";
|
||||
}
|
||||
|
||||
print HTML "</TABLE></P>\n";
|
||||
|
||||
print HTML "<P>Raw data:</P>\n";
|
||||
print HTML $OUT;
|
||||
print HTML "</TABLE></P>\n";
|
||||
}
|
||||
|
||||
print HTML <<EOF;
|
||||
</BODY>
|
||||
</HTML>
|
||||
EOF
|
||||
close(HTML) or die "Can't close $html: $!";
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Append text to the global variable $OUT
|
||||
sub out {
|
||||
$OUT .= join('', @_);
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Append text to the global variable $OUT
|
||||
sub outln {
|
||||
$OUT .= join('', @_) . "\n";
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Measure a given test method with a give test pattern using the
|
||||
# global run parameters.
|
||||
#
|
||||
# @param the method to run
|
||||
# @param the pattern defining characters to test
|
||||
# @param if >0 then the number of iterations per pass. If <0 then
|
||||
# (negative of) the number of seconds per pass.
|
||||
#
|
||||
# @return a Dataset object, scaled by iterations per pass and
|
||||
# events per iteration, to give time per event
|
||||
#
|
||||
sub measure2 {
|
||||
my @data = measure1(@_);
|
||||
my $iterPerPass = shift(@data);
|
||||
my $eventPerIter = shift(@data);
|
||||
|
||||
shift(@data) if (@data > 1); # discard first run
|
||||
|
||||
my $ds = Dataset->new(@data);
|
||||
$ds->setScale(1.0e-3 / ($iterPerPass * $eventPerIter));
|
||||
$ds;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Measure a given test method with a give test pattern using the
|
||||
# global run parameters.
|
||||
#
|
||||
# @param the method to run
|
||||
# @param the pattern defining characters to test
|
||||
# @param if >0 then the number of iterations per pass. If <0 then
|
||||
# (negative of) the number of seconds per pass.
|
||||
#
|
||||
# @return array of:
|
||||
# [0] iterations per pass
|
||||
# [1] events per iteration
|
||||
# [2..] ms reported for each pass, in order
|
||||
#
|
||||
sub measure1 {
|
||||
my $method = shift;
|
||||
my $pat = shift;
|
||||
my $iterCount = shift; # actually might be -seconds/pass
|
||||
|
||||
out("<P>Measuring $method for input file @$pat[0] for encoding @$pat[2] , ");
|
||||
if ($iterCount > 0) {
|
||||
out("$iterCount iterations/pass, $NUMPASSES passes</P>\n");
|
||||
} else {
|
||||
out(-$iterCount, " seconds/pass, $NUMPASSES passes</P>\n");
|
||||
}
|
||||
|
||||
# is $iterCount actually -seconds/pass?
|
||||
if ($iterCount < 0) {
|
||||
|
||||
# calibrate: estimate ms/iteration
|
||||
print "Calibrating...";
|
||||
my @t = callJava($method, $pat, -$CALIBRATE, 1);
|
||||
print "done.\n";
|
||||
|
||||
my @data = split(/\s+/, $t[0]->[2]);
|
||||
$data[0] *= 1.0e+3;
|
||||
|
||||
my $timePerIter = 1.0e-3 * $data[0] / $data[1];
|
||||
|
||||
# determine iterations/pass
|
||||
$iterCount = int(-$iterCount / $timePerIter + 0.5);
|
||||
|
||||
out("<P>Calibration pass ($CALIBRATE sec): ");
|
||||
out("$data[0] ms, ");
|
||||
out("$data[1] iterations = ");
|
||||
out(formatSeconds(4, $timePerIter), "/iteration<BR>\n");
|
||||
}
|
||||
|
||||
# run passes
|
||||
print "Measuring $iterCount iterations x $NUMPASSES passes...";
|
||||
my @t = callJava($method, $pat, $iterCount, $NUMPASSES);
|
||||
print "done.\n";
|
||||
my @ms = ();
|
||||
my @b; # scratch
|
||||
for my $a (@t) {
|
||||
# $a->[0]: method name, corresponds to $method
|
||||
# $a->[1]: 'begin' data, == $iterCount
|
||||
# $a->[2]: 'end' data, of the form <ms> <loops> <eventsPerIter>
|
||||
# $a->[3...]: gc messages from JVM during pass
|
||||
@b = split(/\s+/, $a->[2]);
|
||||
push(@ms, $b[0] * 1.0e+3);
|
||||
}
|
||||
my $eventsPerIter = $b[2];
|
||||
|
||||
out("Iterations per pass: $iterCount<BR>\n");
|
||||
out("Events per iteration: $eventsPerIter<BR>\n");
|
||||
|
||||
my @ms_str = @ms;
|
||||
$ms_str[0] .= " (discarded)" if (@ms_str > 1);
|
||||
out("Raw times (ms/pass): ", join(", ", @ms_str), "<BR>\n");
|
||||
|
||||
($iterCount, $eventsPerIter, @ms);
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Invoke java to run $TESTCLASS, passing it the given parameters.
|
||||
#
|
||||
# @param the method to run
|
||||
# @param the number of iterations, or if negative, the duration
|
||||
# in seconds. If more than on pass is desired, pass in
|
||||
# a string, e.g., "100 100 100".
|
||||
# @param the pattern defining characters to test
|
||||
#
|
||||
# @return an array of results. Each result is an array REF
|
||||
# describing one pass. The array REF contains:
|
||||
# ->[0]: The method name as reported
|
||||
# ->[1]: The params on the '= <meth> begin ...' line
|
||||
# ->[2]: The params on the '= <meth> end ...' line
|
||||
# ->[3..]: GC messages from the JVM, if any
|
||||
#
|
||||
sub callJava {
|
||||
my $method = shift;
|
||||
my $pat = shift;
|
||||
my $n = shift;
|
||||
my $passes = shift;
|
||||
|
||||
my $n = ($n < 0) ? "-t ".(-$n) : "-i ".$n;
|
||||
|
||||
my $cmd = "java -classpath classes $TESTCLASS $method $n -p $passes -L @$pat[0] \"@$pat[1]\" \"@$pat[2]\" -r $THREADS";
|
||||
print "[$cmd]\n"; # for debugging
|
||||
open(PIPE, "$cmd|") or die "Can't run \"$cmd\"";
|
||||
my @out;
|
||||
while (<PIPE>) {
|
||||
push(@out, $_);
|
||||
}
|
||||
close(PIPE) or die "Java failed: \"$cmd\"";
|
||||
|
||||
@out = grep(!/^\#/, @out); # filter out comments
|
||||
|
||||
#print "[", join("\n", @out), "]\n";
|
||||
|
||||
my @results;
|
||||
my $method = '';
|
||||
my $data = [];
|
||||
foreach (@out) {
|
||||
next unless (/\S/);
|
||||
|
||||
if (/^=\s*(\w+)\s*(\w+)\s*(.*)/) {
|
||||
my ($m, $state, $d) = ($1, $2, $3);
|
||||
#print "$_ => [[$m $state $data]]\n";
|
||||
if ($state eq 'begin') {
|
||||
die "$method was begun but not finished" if ($method);
|
||||
$method = $m;
|
||||
push(@$data, $d);
|
||||
push(@$data, ''); # placeholder for end data
|
||||
} elsif ($state eq 'end') {
|
||||
if ($m ne $method) {
|
||||
die "$method end does not match: $_";
|
||||
}
|
||||
$data->[1] = $d; # insert end data at [1]
|
||||
#print "#$method:", join(";",@$data), "\n";
|
||||
unshift(@$data, $method); # add method to start
|
||||
|
||||
push(@results, $data);
|
||||
$method = '';
|
||||
$data = [];
|
||||
} else {
|
||||
die "Can't parse: $_";
|
||||
}
|
||||
}
|
||||
|
||||
elsif (/^\[/) {
|
||||
if ($method) {
|
||||
push(@$data, $_);
|
||||
} else {
|
||||
# ignore extraneous GC notices
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
die "Can't parse: $_";
|
||||
}
|
||||
}
|
||||
|
||||
die "$method was begun but not finished" if ($method);
|
||||
|
||||
@results;
|
||||
}
|
||||
|
||||
#|#---------------------------------------------------------------------
|
||||
#|# Format a confidence interval, as given by a Dataset. Output is as
|
||||
#|# as follows:
|
||||
#|# 241.23 - 241.98 => 241.5 +/- 0.3
|
||||
#|# 241.2 - 243.8 => 242 +/- 1
|
||||
#|# 211.0 - 241.0 => 226 +/- 15 or? 230 +/- 20
|
||||
#|# 220.3 - 234.3 => 227 +/- 7
|
||||
#|# 220.3 - 300.3 => 260 +/- 40
|
||||
#|# 220.3 - 1000 => 610 +/- 390 or? 600 +/- 400
|
||||
#|# 0.022 - 0.024 => 0.023 +/- 0.001
|
||||
#|# 0.022 - 0.032 => 0.027 +/- 0.005
|
||||
#|# 0.022 - 1.000 => 0.5 +/- 0.5
|
||||
#|# In other words, take one significant digit of the error value and
|
||||
#|# display the mean to the same precision.
|
||||
#|sub formatDataset {
|
||||
#| my $ds = shift;
|
||||
#| my $lower = $ds->getMean() - $ds->getError();
|
||||
#| my $upper = $ds->getMean() + $ds->getError();
|
||||
#| my $scale = 0;
|
||||
#| # Find how many initial digits are the same
|
||||
#| while ($lower < 1 ||
|
||||
#| int($lower) == int($upper)) {
|
||||
#| $lower *= 10;
|
||||
#| $upper *= 10;
|
||||
#| $scale++;
|
||||
#| }
|
||||
#| while ($lower >= 10 &&
|
||||
#| int($lower) == int($upper)) {
|
||||
#| $lower /= 10;
|
||||
#| $upper /= 10;
|
||||
#| $scale--;
|
||||
#| }
|
||||
#|}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Format a number, optionally with a +/- delta, to n significant
|
||||
# digits.
|
||||
#
|
||||
# @param significant digit, a value >= 1
|
||||
# @param multiplier
|
||||
# @param time in seconds to be formatted
|
||||
# @optional delta in seconds
|
||||
#
|
||||
# @return string of the form "23" or "23 +/- 10".
|
||||
#
|
||||
sub formatNumber {
|
||||
my $sigdig = shift;
|
||||
my $mult = shift;
|
||||
my $a = shift;
|
||||
my $delta = shift; # may be undef
|
||||
|
||||
my $result = formatSigDig($sigdig, $a*$mult);
|
||||
if (defined($delta)) {
|
||||
my $d = formatSigDig($sigdig, $delta*$mult);
|
||||
# restrict PRECISION of delta to that of main number
|
||||
if ($result =~ /\.(\d+)/) {
|
||||
# TODO make this work for values with all significant
|
||||
# digits to the left of the decimal, e.g., 1234000.
|
||||
|
||||
# TODO the other thing wrong with this is that it
|
||||
# isn't rounding the $delta properly. Have to put
|
||||
# this logic into formatSigDig().
|
||||
my $x = length($1);
|
||||
$d =~ s/\.(\d{$x})\d+/.$1/;
|
||||
}
|
||||
$result .= " $PLUS_MINUS " . $d;
|
||||
}
|
||||
$result;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Format a time, optionally with a +/- delta, to n significant
|
||||
# digits.
|
||||
#
|
||||
# @param significant digit, a value >= 1
|
||||
# @param time in seconds to be formatted
|
||||
# @optional delta in seconds
|
||||
#
|
||||
# @return string of the form "23 ms" or "23 +/- 10 ms".
|
||||
#
|
||||
sub formatSeconds {
|
||||
my $sigdig = shift;
|
||||
my $a = shift;
|
||||
my $delta = shift; # may be undef
|
||||
|
||||
my @MULT = (1 , 1e3, 1e6, 1e9);
|
||||
my @SUFF = ('s' , 'ms', 'us', 'ns');
|
||||
|
||||
# Determine our scale
|
||||
my $i = 0;
|
||||
++$i while ($a*$MULT[$i] < 1 && $i < @MULT);
|
||||
|
||||
formatNumber($sigdig, $MULT[$i], $a, $delta) . ' ' . $SUFF[$i];
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Format a percentage, optionally with a +/- delta, to n significant
|
||||
# digits.
|
||||
#
|
||||
# @param significant digit, a value >= 1
|
||||
# @param value to be formatted, as a fraction, e.g. 0.5 for 50%
|
||||
# @optional delta, as a fraction
|
||||
#
|
||||
# @return string of the form "23 %" or "23 +/- 10 %".
|
||||
#
|
||||
sub formatPercent {
|
||||
my $sigdig = shift;
|
||||
my $a = shift;
|
||||
my $delta = shift; # may be undef
|
||||
|
||||
formatNumber($sigdig, 100, $a, $delta) . ' %';
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Format a number to n significant digits without using exponential
|
||||
# notation.
|
||||
#
|
||||
# @param significant digit, a value >= 1
|
||||
# @param number to be formatted
|
||||
#
|
||||
# @return string of the form "1234" "12.34" or "0.001234". If
|
||||
# number was negative, prefixed by '-'.
|
||||
#
|
||||
sub formatSigDig {
|
||||
my $n = shift() - 1;
|
||||
my $a = shift;
|
||||
|
||||
local $_ = sprintf("%.${n}e", $a);
|
||||
my $sign = (s/^-//) ? '-' : '';
|
||||
|
||||
my $a_e;
|
||||
my $result;
|
||||
if (/^(\d)\.(\d+)e([-+]\d+)$/) {
|
||||
my ($d, $dn, $e) = ($1, $2, $3);
|
||||
$a_e = $e;
|
||||
$d .= $dn;
|
||||
$e++;
|
||||
$d .= '0' while ($e > length($d));
|
||||
while ($e < 1) {
|
||||
$e++;
|
||||
$d = '0' . $d;
|
||||
}
|
||||
if ($e == length($d)) {
|
||||
$result = $sign . $d;
|
||||
} else {
|
||||
$result = $sign . substr($d, 0, $e) . '.' . substr($d, $e);
|
||||
}
|
||||
} else {
|
||||
die "Can't parse $_";
|
||||
}
|
||||
$result;
|
||||
}
|
||||
|
||||
#eof
|
||||
#!/usr/local/bin/perl
|
||||
# *******************************************************************************
|
||||
# * Copyright (C) 2002-2007 International Business Machines Corporation and *
|
||||
# * others. All Rights Reserved. *
|
||||
# *******************************************************************************
|
||||
|
||||
use strict;
|
||||
|
||||
# Assume we are running within the icu4j root directory
|
||||
use lib 'src/com/ibm/icu/dev/test/perf';
|
||||
use Dataset;
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Test class
|
||||
my $TESTCLASS = 'com.ibm.icu.dev.test.perf.DateFormatPerformanceTest';
|
||||
|
||||
# Methods to be tested. Each pair represents a test method and
|
||||
# a baseline method which is used for comparison.
|
||||
my @METHODS = (
|
||||
['TestJDKConstruction', 'TestICUConstruction'],
|
||||
['TestJDKParse', 'TestICUParse'],
|
||||
['TestJDKFormat', 'TestICUFormat']
|
||||
);
|
||||
# Patterns which define the set of characters used for testing.
|
||||
my @OPTIONS = (
|
||||
# locale pattern date string
|
||||
[ "en_US", "dddd MMM yyyy", "15 Jan 2007"],
|
||||
[ "sw_KE", "dddd MMM yyyy", "15 Jan 2007"],
|
||||
[ "en_US", "HH:mm", "13:13"],
|
||||
[ "en_US", "HH:mm zzzz", "13:13 Pacific Standard Time"],
|
||||
[ "en_US", "HH:mm z", "13:13 PST"],
|
||||
[ "en_US", "HH:mm Z", "13:13 -0800"],
|
||||
);
|
||||
|
||||
my $THREADS; # number of threads (input from command-line args)
|
||||
my $CALIBRATE = 2; # duration in seconds for initial calibration
|
||||
my $DURATION = 10; # duration in seconds for each pass
|
||||
my $NUMPASSES = 4; # number of passes. If > 1 then the first pass
|
||||
# is discarded as a JIT warm-up pass.
|
||||
|
||||
my $TABLEATTR = 'BORDER="1" CELLPADDING="4" CELLSPACING="0"';
|
||||
|
||||
my $PLUS_MINUS = "±";
|
||||
|
||||
if ($NUMPASSES < 3) {
|
||||
die "Need at least 3 passes. One is discarded (JIT warmup) and need two to have 1 degree of freedom (t distribution).";
|
||||
}
|
||||
|
||||
my $OUT; # see out()
|
||||
|
||||
# run all tests with the specified number of threads from command-line input
|
||||
# (if there is no arguments, use $THREADS = 1)
|
||||
foreach my $arg ($#ARGV >= 0 ? @ARGV : "1") {
|
||||
$THREADS = $arg;
|
||||
main();
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# ...
|
||||
sub main {
|
||||
my $date = localtime;
|
||||
my $threads = ($THREADS > 1) ? "($THREADS threads)" : "";
|
||||
my $title = "ICU4J Performance Test $threads $date";
|
||||
|
||||
my $html = $date;
|
||||
$html =~ s/://g; # ':' illegal
|
||||
$html =~ s/\s*\d+$//; # delete year
|
||||
$html =~ s/^\w+\s*//; # delete dow
|
||||
$html = "perf $html.html";
|
||||
|
||||
open(HTML,">$html") or die "Can't write to $html: $!";
|
||||
|
||||
print HTML <<EOF;
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>$title</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
EOF
|
||||
print HTML "<H1>$title</H1>\n";
|
||||
|
||||
print HTML "<H2>$TESTCLASS</H2>\n";
|
||||
|
||||
my $raw = "";
|
||||
|
||||
for my $methodPair (@METHODS) {
|
||||
|
||||
my $testMethod = $methodPair->[0];
|
||||
my $baselineMethod = $methodPair->[1];
|
||||
|
||||
print HTML "<P><TABLE $TABLEATTR><TR><TD>\n";
|
||||
print HTML "<P><B>$testMethod vs. $baselineMethod</B></P>\n";
|
||||
|
||||
print HTML "<P><TABLE $TABLEATTR BGCOLOR=\"#CCFFFF\">\n";
|
||||
print HTML "<TR><TD>Options</TD><TD>$testMethod</TD>";
|
||||
print HTML "<TD>$baselineMethod</TD><TD>Ratio</TD></TR>\n";
|
||||
|
||||
$OUT = '';
|
||||
|
||||
for my $pat (@OPTIONS) {
|
||||
print HTML "<TR><TD>@$pat[0], \"@$pat[1]\", \"@$pat[2]\"</TD>\n";
|
||||
|
||||
out("<P><TABLE $TABLEATTR WIDTH=\"100%\">");
|
||||
|
||||
# measure the test method
|
||||
out("<TR><TD>");
|
||||
print "\n$testMethod [@$pat]\n";
|
||||
my $t = measure2($testMethod, $pat, -$DURATION);
|
||||
out("</TD></TR>");
|
||||
print HTML "<TD>", formatSeconds(4, $t->getMean(), $t->getError);
|
||||
print HTML "/event</TD>\n";
|
||||
|
||||
# measure baseline method
|
||||
out("<TR><TD>");
|
||||
print "\n$baselineMethod [@$pat]\n";
|
||||
my $b = measure2($baselineMethod, $pat, -$DURATION);
|
||||
out("</TD></TR>");
|
||||
print HTML "<TD>", formatSeconds(4, $b->getMean(), $t->getError);
|
||||
print HTML "/event</TD>\n";
|
||||
|
||||
out("</TABLE></P>");
|
||||
|
||||
# output ratio
|
||||
my $r = $t->divide($b);
|
||||
my $mean = $r->getMean() - 1;
|
||||
my $color = $mean < 0 ? "RED" : "BLACK";
|
||||
print HTML "<TD><B><FONT COLOR=\"$color\">", formatPercent(3, $mean, $r->getError);
|
||||
print HTML "</FONT></B></TD></TR>\n";
|
||||
}
|
||||
|
||||
print HTML "</TABLE></P>\n";
|
||||
|
||||
print HTML "<P>Raw data:</P>\n";
|
||||
print HTML $OUT;
|
||||
print HTML "</TABLE></P>\n";
|
||||
}
|
||||
|
||||
print HTML <<EOF;
|
||||
</BODY>
|
||||
</HTML>
|
||||
EOF
|
||||
close(HTML) or die "Can't close $html: $!";
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Append text to the global variable $OUT
|
||||
sub out {
|
||||
$OUT .= join('', @_);
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Append text to the global variable $OUT
|
||||
sub outln {
|
||||
$OUT .= join('', @_) . "\n";
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Measure a given test method with a give test pattern using the
|
||||
# global run parameters.
|
||||
#
|
||||
# @param the method to run
|
||||
# @param the pattern defining characters to test
|
||||
# @param if >0 then the number of iterations per pass. If <0 then
|
||||
# (negative of) the number of seconds per pass.
|
||||
#
|
||||
# @return a Dataset object, scaled by iterations per pass and
|
||||
# events per iteration, to give time per event
|
||||
#
|
||||
sub measure2 {
|
||||
my @data = measure1(@_);
|
||||
my $iterPerPass = shift(@data);
|
||||
my $eventPerIter = shift(@data);
|
||||
|
||||
shift(@data) if (@data > 1); # discard first run
|
||||
|
||||
my $ds = Dataset->new(@data);
|
||||
$ds->setScale(1.0e-3 / ($iterPerPass * $eventPerIter));
|
||||
$ds;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Measure a given test method with a give test pattern using the
|
||||
# global run parameters.
|
||||
#
|
||||
# @param the method to run
|
||||
# @param the pattern defining characters to test
|
||||
# @param if >0 then the number of iterations per pass. If <0 then
|
||||
# (negative of) the number of seconds per pass.
|
||||
#
|
||||
# @return array of:
|
||||
# [0] iterations per pass
|
||||
# [1] events per iteration
|
||||
# [2..] ms reported for each pass, in order
|
||||
#
|
||||
sub measure1 {
|
||||
my $method = shift;
|
||||
my $pat = shift;
|
||||
my $iterCount = shift; # actually might be -seconds/pass
|
||||
|
||||
out("<P>Measuring $method for input file @$pat[0] for encoding @$pat[2] , ");
|
||||
if ($iterCount > 0) {
|
||||
out("$iterCount iterations/pass, $NUMPASSES passes</P>\n");
|
||||
} else {
|
||||
out(-$iterCount, " seconds/pass, $NUMPASSES passes</P>\n");
|
||||
}
|
||||
|
||||
# is $iterCount actually -seconds/pass?
|
||||
if ($iterCount < 0) {
|
||||
|
||||
# calibrate: estimate ms/iteration
|
||||
print "Calibrating...";
|
||||
my @t = callJava($method, $pat, -$CALIBRATE, 1);
|
||||
print "done.\n";
|
||||
|
||||
my @data = split(/\s+/, $t[0]->[2]);
|
||||
$data[0] *= 1.0e+3;
|
||||
|
||||
my $timePerIter = 1.0e-3 * $data[0] / $data[1];
|
||||
|
||||
# determine iterations/pass
|
||||
$iterCount = int(-$iterCount / $timePerIter + 0.5);
|
||||
|
||||
out("<P>Calibration pass ($CALIBRATE sec): ");
|
||||
out("$data[0] ms, ");
|
||||
out("$data[1] iterations = ");
|
||||
out(formatSeconds(4, $timePerIter), "/iteration<BR>\n");
|
||||
}
|
||||
|
||||
# run passes
|
||||
print "Measuring $iterCount iterations x $NUMPASSES passes...";
|
||||
my @t = callJava($method, $pat, $iterCount, $NUMPASSES);
|
||||
print "done.\n";
|
||||
my @ms = ();
|
||||
my @b; # scratch
|
||||
for my $a (@t) {
|
||||
# $a->[0]: method name, corresponds to $method
|
||||
# $a->[1]: 'begin' data, == $iterCount
|
||||
# $a->[2]: 'end' data, of the form <ms> <loops> <eventsPerIter>
|
||||
# $a->[3...]: gc messages from JVM during pass
|
||||
@b = split(/\s+/, $a->[2]);
|
||||
push(@ms, $b[0] * 1.0e+3);
|
||||
}
|
||||
my $eventsPerIter = $b[2];
|
||||
|
||||
out("Iterations per pass: $iterCount<BR>\n");
|
||||
out("Events per iteration: $eventsPerIter<BR>\n");
|
||||
|
||||
my @ms_str = @ms;
|
||||
$ms_str[0] .= " (discarded)" if (@ms_str > 1);
|
||||
out("Raw times (ms/pass): ", join(", ", @ms_str), "<BR>\n");
|
||||
|
||||
($iterCount, $eventsPerIter, @ms);
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Invoke java to run $TESTCLASS, passing it the given parameters.
|
||||
#
|
||||
# @param the method to run
|
||||
# @param the number of iterations, or if negative, the duration
|
||||
# in seconds. If more than on pass is desired, pass in
|
||||
# a string, e.g., "100 100 100".
|
||||
# @param the pattern defining characters to test
|
||||
#
|
||||
# @return an array of results. Each result is an array REF
|
||||
# describing one pass. The array REF contains:
|
||||
# ->[0]: The method name as reported
|
||||
# ->[1]: The params on the '= <meth> begin ...' line
|
||||
# ->[2]: The params on the '= <meth> end ...' line
|
||||
# ->[3..]: GC messages from the JVM, if any
|
||||
#
|
||||
sub callJava {
|
||||
my $method = shift;
|
||||
my $pat = shift;
|
||||
my $n = shift;
|
||||
my $passes = shift;
|
||||
|
||||
my $n = ($n < 0) ? "-t ".(-$n) : "-i ".$n;
|
||||
|
||||
my $cmd = "java -classpath classes $TESTCLASS $method $n -p $passes -L @$pat[0] \"@$pat[1]\" \"@$pat[2]\" -r $THREADS";
|
||||
print "[$cmd]\n"; # for debugging
|
||||
open(PIPE, "$cmd|") or die "Can't run \"$cmd\"";
|
||||
my @out;
|
||||
while (<PIPE>) {
|
||||
push(@out, $_);
|
||||
}
|
||||
close(PIPE) or die "Java failed: \"$cmd\"";
|
||||
|
||||
@out = grep(!/^\#/, @out); # filter out comments
|
||||
|
||||
#print "[", join("\n", @out), "]\n";
|
||||
|
||||
my @results;
|
||||
my $method = '';
|
||||
my $data = [];
|
||||
foreach (@out) {
|
||||
next unless (/\S/);
|
||||
|
||||
if (/^=\s*(\w+)\s*(\w+)\s*(.*)/) {
|
||||
my ($m, $state, $d) = ($1, $2, $3);
|
||||
#print "$_ => [[$m $state $data]]\n";
|
||||
if ($state eq 'begin') {
|
||||
die "$method was begun but not finished" if ($method);
|
||||
$method = $m;
|
||||
push(@$data, $d);
|
||||
push(@$data, ''); # placeholder for end data
|
||||
} elsif ($state eq 'end') {
|
||||
if ($m ne $method) {
|
||||
die "$method end does not match: $_";
|
||||
}
|
||||
$data->[1] = $d; # insert end data at [1]
|
||||
#print "#$method:", join(";",@$data), "\n";
|
||||
unshift(@$data, $method); # add method to start
|
||||
|
||||
push(@results, $data);
|
||||
$method = '';
|
||||
$data = [];
|
||||
} else {
|
||||
die "Can't parse: $_";
|
||||
}
|
||||
}
|
||||
|
||||
elsif (/^\[/) {
|
||||
if ($method) {
|
||||
push(@$data, $_);
|
||||
} else {
|
||||
# ignore extraneous GC notices
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
die "Can't parse: $_";
|
||||
}
|
||||
}
|
||||
|
||||
die "$method was begun but not finished" if ($method);
|
||||
|
||||
@results;
|
||||
}
|
||||
|
||||
#|#---------------------------------------------------------------------
|
||||
#|# Format a confidence interval, as given by a Dataset. Output is as
|
||||
#|# as follows:
|
||||
#|# 241.23 - 241.98 => 241.5 +/- 0.3
|
||||
#|# 241.2 - 243.8 => 242 +/- 1
|
||||
#|# 211.0 - 241.0 => 226 +/- 15 or? 230 +/- 20
|
||||
#|# 220.3 - 234.3 => 227 +/- 7
|
||||
#|# 220.3 - 300.3 => 260 +/- 40
|
||||
#|# 220.3 - 1000 => 610 +/- 390 or? 600 +/- 400
|
||||
#|# 0.022 - 0.024 => 0.023 +/- 0.001
|
||||
#|# 0.022 - 0.032 => 0.027 +/- 0.005
|
||||
#|# 0.022 - 1.000 => 0.5 +/- 0.5
|
||||
#|# In other words, take one significant digit of the error value and
|
||||
#|# display the mean to the same precision.
|
||||
#|sub formatDataset {
|
||||
#| my $ds = shift;
|
||||
#| my $lower = $ds->getMean() - $ds->getError();
|
||||
#| my $upper = $ds->getMean() + $ds->getError();
|
||||
#| my $scale = 0;
|
||||
#| # Find how many initial digits are the same
|
||||
#| while ($lower < 1 ||
|
||||
#| int($lower) == int($upper)) {
|
||||
#| $lower *= 10;
|
||||
#| $upper *= 10;
|
||||
#| $scale++;
|
||||
#| }
|
||||
#| while ($lower >= 10 &&
|
||||
#| int($lower) == int($upper)) {
|
||||
#| $lower /= 10;
|
||||
#| $upper /= 10;
|
||||
#| $scale--;
|
||||
#| }
|
||||
#|}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Format a number, optionally with a +/- delta, to n significant
|
||||
# digits.
|
||||
#
|
||||
# @param significant digit, a value >= 1
|
||||
# @param multiplier
|
||||
# @param time in seconds to be formatted
|
||||
# @optional delta in seconds
|
||||
#
|
||||
# @return string of the form "23" or "23 +/- 10".
|
||||
#
|
||||
sub formatNumber {
|
||||
my $sigdig = shift;
|
||||
my $mult = shift;
|
||||
my $a = shift;
|
||||
my $delta = shift; # may be undef
|
||||
|
||||
my $result = formatSigDig($sigdig, $a*$mult);
|
||||
if (defined($delta)) {
|
||||
my $d = formatSigDig($sigdig, $delta*$mult);
|
||||
# restrict PRECISION of delta to that of main number
|
||||
if ($result =~ /\.(\d+)/) {
|
||||
# TODO make this work for values with all significant
|
||||
# digits to the left of the decimal, e.g., 1234000.
|
||||
|
||||
# TODO the other thing wrong with this is that it
|
||||
# isn't rounding the $delta properly. Have to put
|
||||
# this logic into formatSigDig().
|
||||
my $x = length($1);
|
||||
$d =~ s/\.(\d{$x})\d+/.$1/;
|
||||
}
|
||||
$result .= " $PLUS_MINUS " . $d;
|
||||
}
|
||||
$result;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Format a time, optionally with a +/- delta, to n significant
|
||||
# digits.
|
||||
#
|
||||
# @param significant digit, a value >= 1
|
||||
# @param time in seconds to be formatted
|
||||
# @optional delta in seconds
|
||||
#
|
||||
# @return string of the form "23 ms" or "23 +/- 10 ms".
|
||||
#
|
||||
sub formatSeconds {
|
||||
my $sigdig = shift;
|
||||
my $a = shift;
|
||||
my $delta = shift; # may be undef
|
||||
|
||||
my @MULT = (1 , 1e3, 1e6, 1e9);
|
||||
my @SUFF = ('s' , 'ms', 'us', 'ns');
|
||||
|
||||
# Determine our scale
|
||||
my $i = 0;
|
||||
++$i while ($a*$MULT[$i] < 1 && $i < @MULT);
|
||||
|
||||
formatNumber($sigdig, $MULT[$i], $a, $delta) . ' ' . $SUFF[$i];
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Format a percentage, optionally with a +/- delta, to n significant
|
||||
# digits.
|
||||
#
|
||||
# @param significant digit, a value >= 1
|
||||
# @param value to be formatted, as a fraction, e.g. 0.5 for 50%
|
||||
# @optional delta, as a fraction
|
||||
#
|
||||
# @return string of the form "23 %" or "23 +/- 10 %".
|
||||
#
|
||||
sub formatPercent {
|
||||
my $sigdig = shift;
|
||||
my $a = shift;
|
||||
my $delta = shift; # may be undef
|
||||
|
||||
formatNumber($sigdig, 100, $a, $delta) . ' %';
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Format a number to n significant digits without using exponential
|
||||
# notation.
|
||||
#
|
||||
# @param significant digit, a value >= 1
|
||||
# @param number to be formatted
|
||||
#
|
||||
# @return string of the form "1234" "12.34" or "0.001234". If
|
||||
# number was negative, prefixed by '-'.
|
||||
#
|
||||
sub formatSigDig {
|
||||
my $n = shift() - 1;
|
||||
my $a = shift;
|
||||
|
||||
local $_ = sprintf("%.${n}e", $a);
|
||||
my $sign = (s/^-//) ? '-' : '';
|
||||
|
||||
my $a_e;
|
||||
my $result;
|
||||
if (/^(\d)\.(\d+)e([-+]\d+)$/) {
|
||||
my ($d, $dn, $e) = ($1, $2, $3);
|
||||
$a_e = $e;
|
||||
$d .= $dn;
|
||||
$e++;
|
||||
$d .= '0' while ($e > length($d));
|
||||
while ($e < 1) {
|
||||
$e++;
|
||||
$d = '0' . $d;
|
||||
}
|
||||
if ($e == length($d)) {
|
||||
$result = $sign . $d;
|
||||
} else {
|
||||
$result = $sign . substr($d, 0, $e) . '.' . substr($d, $e);
|
||||
}
|
||||
} else {
|
||||
die "Can't parse $_";
|
||||
}
|
||||
$result;
|
||||
}
|
||||
|
||||
#eof
|
||||
|
|
982
src/com/ibm/icu/dev/test/perf/decimalformatperf.pl
Normal file → Executable file
982
src/com/ibm/icu/dev/test/perf/decimalformatperf.pl
Normal file → Executable file
|
@ -1,491 +1,491 @@
|
|||
#!/usr/local/bin/perl
|
||||
# *******************************************************************************
|
||||
# * Copyright (C) 2002-2007 International Business Machines Corporation and *
|
||||
# * others. All Rights Reserved. *
|
||||
# *******************************************************************************
|
||||
|
||||
use strict;
|
||||
|
||||
# Assume we are running within the icu4j root directory
|
||||
use lib 'src/com/ibm/icu/dev/test/perf';
|
||||
use Dataset;
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Test class
|
||||
my $TESTCLASS = 'com.ibm.icu.dev.test.perf.DecimalFormatPerformanceTest';
|
||||
|
||||
# Methods to be tested. Each pair represents a test method and
|
||||
# a baseline method which is used for comparison.
|
||||
my @METHODS = (
|
||||
['TestJDKConstruction', 'TestICUConstruction'],
|
||||
['TestJDKParse', 'TestICUParse'],
|
||||
['TestJDKFormat', 'TestICUFormat']
|
||||
);
|
||||
# Patterns which define the set of characters used for testing.
|
||||
my @OPTIONS = (
|
||||
# locale pattern date string
|
||||
[ "en_US", "#,###.##", "1,234.56"],
|
||||
[ "de_DE", "#,###.##", "1.234,56"],
|
||||
);
|
||||
|
||||
my $THREADS; # number of threads (input from command-line args)
|
||||
my $CALIBRATE = 2; # duration in seconds for initial calibration
|
||||
my $DURATION = 10; # duration in seconds for each pass
|
||||
my $NUMPASSES = 4; # number of passes. If > 1 then the first pass
|
||||
# is discarded as a JIT warm-up pass.
|
||||
|
||||
my $TABLEATTR = 'BORDER="1" CELLPADDING="4" CELLSPACING="0"';
|
||||
|
||||
my $PLUS_MINUS = "±";
|
||||
|
||||
if ($NUMPASSES < 3) {
|
||||
die "Need at least 3 passes. One is discarded (JIT warmup) and need two to have 1 degree of freedom (t distribution).";
|
||||
}
|
||||
|
||||
my $OUT; # see out()
|
||||
|
||||
# run all tests with the specified number of threads from command-line input
|
||||
# (if there is no arguments, use $THREADS = 1)
|
||||
foreach my $arg ($#ARGV >= 0 ? @ARGV : "1") {
|
||||
$THREADS = $arg;
|
||||
main();
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# ...
|
||||
sub main {
|
||||
my $date = localtime;
|
||||
my $threads = ($THREADS > 1) ? "($THREADS threads)" : "";
|
||||
my $title = "ICU4J Performance Test $threads $date";
|
||||
|
||||
my $html = $date;
|
||||
$html =~ s/://g; # ':' illegal
|
||||
$html =~ s/\s*\d+$//; # delete year
|
||||
$html =~ s/^\w+\s*//; # delete dow
|
||||
$html = "perf $html.html";
|
||||
|
||||
open(HTML,">$html") or die "Can't write to $html: $!";
|
||||
|
||||
print HTML <<EOF;
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>$title</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
EOF
|
||||
print HTML "<H1>$title</H1>\n";
|
||||
|
||||
print HTML "<H2>$TESTCLASS</H2>\n";
|
||||
|
||||
my $raw = "";
|
||||
|
||||
for my $methodPair (@METHODS) {
|
||||
|
||||
my $testMethod = $methodPair->[0];
|
||||
my $baselineMethod = $methodPair->[1];
|
||||
|
||||
print HTML "<P><TABLE $TABLEATTR><TR><TD>\n";
|
||||
print HTML "<P><B>$testMethod vs. $baselineMethod</B></P>\n";
|
||||
|
||||
print HTML "<P><TABLE $TABLEATTR BGCOLOR=\"#CCFFFF\">\n";
|
||||
print HTML "<TR><TD>Options</TD><TD>$testMethod</TD>";
|
||||
print HTML "<TD>$baselineMethod</TD><TD>Ratio</TD></TR>\n";
|
||||
$OUT = '';
|
||||
|
||||
for my $pat (@OPTIONS) {
|
||||
print HTML "<TR><TD>@$pat[0], \"@$pat[1]\", \"@$pat[2]\"</TD>\n";
|
||||
|
||||
out("<P><TABLE $TABLEATTR WIDTH=\"100%\">");
|
||||
|
||||
# measure the test method
|
||||
out("<TR><TD>");
|
||||
print "\n$testMethod [@$pat]\n";
|
||||
my $t = measure2($testMethod, $pat, -$DURATION);
|
||||
out("</TD></TR>");
|
||||
print HTML "<TD>", formatSeconds(4, $t->getMean(), $t->getError);
|
||||
print HTML "/event</TD>\n";
|
||||
|
||||
# measure baseline method
|
||||
out("<TR><TD>");
|
||||
print "\n$baselineMethod [@$pat]\n";
|
||||
my $b = measure2($baselineMethod, $pat, -$DURATION);
|
||||
out("</TD></TR>");
|
||||
print HTML "<TD>", formatSeconds(4, $b->getMean(), $t->getError);
|
||||
print HTML "/event</TD>\n";
|
||||
|
||||
out("</TABLE></P>");
|
||||
|
||||
# output ratio
|
||||
my $r = $t->divide($b);
|
||||
my $mean = $r->getMean() - 1;
|
||||
my $color = $mean < 0 ? "RED" : "BLACK";
|
||||
print HTML "<TD><B><FONT COLOR=\"$color\">", formatPercent(3, $mean, $r->getError);
|
||||
print HTML "</FONT></B></TD></TR>\n";
|
||||
}
|
||||
|
||||
print HTML "</TABLE></P>\n";
|
||||
|
||||
print HTML "<P>Raw data:</P>\n";
|
||||
print HTML $OUT;
|
||||
print HTML "</TABLE></P>\n";
|
||||
}
|
||||
|
||||
print HTML <<EOF;
|
||||
</BODY>
|
||||
</HTML>
|
||||
EOF
|
||||
close(HTML) or die "Can't close $html: $!";
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Append text to the global variable $OUT
|
||||
sub out {
|
||||
$OUT .= join('', @_);
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Append text to the global variable $OUT
|
||||
sub outln {
|
||||
$OUT .= join('', @_) . "\n";
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Measure a given test method with a give test pattern using the
|
||||
# global run parameters.
|
||||
#
|
||||
# @param the method to run
|
||||
# @param the pattern defining characters to test
|
||||
# @param if >0 then the number of iterations per pass. If <0 then
|
||||
# (negative of) the number of seconds per pass.
|
||||
#
|
||||
# @return a Dataset object, scaled by iterations per pass and
|
||||
# events per iteration, to give time per event
|
||||
#
|
||||
sub measure2 {
|
||||
my @data = measure1(@_);
|
||||
my $iterPerPass = shift(@data);
|
||||
my $eventPerIter = shift(@data);
|
||||
|
||||
shift(@data) if (@data > 1); # discard first run
|
||||
|
||||
my $ds = Dataset->new(@data);
|
||||
$ds->setScale(1.0e-3 / ($iterPerPass * $eventPerIter));
|
||||
$ds;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Measure a given test method with a give test pattern using the
|
||||
# global run parameters.
|
||||
#
|
||||
# @param the method to run
|
||||
# @param the pattern defining characters to test
|
||||
# @param if >0 then the number of iterations per pass. If <0 then
|
||||
# (negative of) the number of seconds per pass.
|
||||
#
|
||||
# @return array of:
|
||||
# [0] iterations per pass
|
||||
# [1] events per iteration
|
||||
# [2..] ms reported for each pass, in order
|
||||
#
|
||||
sub measure1 {
|
||||
my $method = shift;
|
||||
my $pat = shift;
|
||||
my $iterCount = shift; # actually might be -seconds/pass
|
||||
|
||||
out("<P>Measuring $method for input file @$pat[0] for encoding @$pat[2] , ");
|
||||
if ($iterCount > 0) {
|
||||
out("$iterCount iterations/pass, $NUMPASSES passes</P>\n");
|
||||
} else {
|
||||
out(-$iterCount, " seconds/pass, $NUMPASSES passes</P>\n");
|
||||
}
|
||||
|
||||
# is $iterCount actually -seconds/pass?
|
||||
if ($iterCount < 0) {
|
||||
|
||||
# calibrate: estimate ms/iteration
|
||||
print "Calibrating...";
|
||||
my @t = callJava($method, $pat, -$CALIBRATE, 1);
|
||||
print "done.\n";
|
||||
|
||||
my @data = split(/\s+/, $t[0]->[2]);
|
||||
$data[0] *= 1.0e+3;
|
||||
|
||||
my $timePerIter = 1.0e-3 * $data[0] / $data[1];
|
||||
|
||||
# determine iterations/pass
|
||||
$iterCount = int(-$iterCount / $timePerIter + 0.5);
|
||||
|
||||
out("<P>Calibration pass ($CALIBRATE sec): ");
|
||||
out("$data[0] ms, ");
|
||||
out("$data[1] iterations = ");
|
||||
out(formatSeconds(4, $timePerIter), "/iteration<BR>\n");
|
||||
}
|
||||
|
||||
# run passes
|
||||
print "Measuring $iterCount iterations x $NUMPASSES passes...";
|
||||
my @t = callJava($method, $pat, $iterCount, $NUMPASSES);
|
||||
print "done.\n";
|
||||
my @ms = ();
|
||||
my @b; # scratch
|
||||
for my $a (@t) {
|
||||
# $a->[0]: method name, corresponds to $method
|
||||
# $a->[1]: 'begin' data, == $iterCount
|
||||
# $a->[2]: 'end' data, of the form <ms> <loops> <eventsPerIter>
|
||||
# $a->[3...]: gc messages from JVM during pass
|
||||
@b = split(/\s+/, $a->[2]);
|
||||
push(@ms, $b[0] * 1.0e+3);
|
||||
}
|
||||
my $eventsPerIter = $b[2];
|
||||
|
||||
out("Iterations per pass: $iterCount<BR>\n");
|
||||
out("Events per iteration: $eventsPerIter<BR>\n");
|
||||
|
||||
my @ms_str = @ms;
|
||||
$ms_str[0] .= " (discarded)" if (@ms_str > 1);
|
||||
out("Raw times (ms/pass): ", join(", ", @ms_str), "<BR>\n");
|
||||
|
||||
($iterCount, $eventsPerIter, @ms);
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Invoke java to run $TESTCLASS, passing it the given parameters.
|
||||
#
|
||||
# @param the method to run
|
||||
# @param the number of iterations, or if negative, the duration
|
||||
# in seconds. If more than on pass is desired, pass in
|
||||
# a string, e.g., "100 100 100".
|
||||
# @param the pattern defining characters to test
|
||||
#
|
||||
# @return an array of results. Each result is an array REF
|
||||
# describing one pass. The array REF contains:
|
||||
# ->[0]: The method name as reported
|
||||
# ->[1]: The params on the '= <meth> begin ...' line
|
||||
# ->[2]: The params on the '= <meth> end ...' line
|
||||
# ->[3..]: GC messages from the JVM, if any
|
||||
#
|
||||
sub callJava {
|
||||
my $method = shift;
|
||||
my $pat = shift;
|
||||
my $n = shift;
|
||||
my $passes = shift;
|
||||
|
||||
my $n = ($n < 0) ? "-t ".(-$n) : "-i ".$n;
|
||||
|
||||
my $cmd = "java -classpath classes $TESTCLASS $method $n -p $passes -L @$pat[0] \"@$pat[1]\" \"@$pat[2]\" -r $THREADS";
|
||||
print "[$cmd]\n"; # for debugging
|
||||
open(PIPE, "$cmd|") or die "Can't run \"$cmd\"";
|
||||
my @out;
|
||||
while (<PIPE>) {
|
||||
push(@out, $_);
|
||||
}
|
||||
close(PIPE) or die "Java failed: \"$cmd\"";
|
||||
|
||||
@out = grep(!/^\#/, @out); # filter out comments
|
||||
|
||||
#print "[", join("\n", @out), "]\n";
|
||||
|
||||
my @results;
|
||||
my $method = '';
|
||||
my $data = [];
|
||||
foreach (@out) {
|
||||
next unless (/\S/);
|
||||
|
||||
if (/^=\s*(\w+)\s*(\w+)\s*(.*)/) {
|
||||
my ($m, $state, $d) = ($1, $2, $3);
|
||||
#print "$_ => [[$m $state $data]]\n";
|
||||
if ($state eq 'begin') {
|
||||
die "$method was begun but not finished" if ($method);
|
||||
$method = $m;
|
||||
push(@$data, $d);
|
||||
push(@$data, ''); # placeholder for end data
|
||||
} elsif ($state eq 'end') {
|
||||
if ($m ne $method) {
|
||||
die "$method end does not match: $_";
|
||||
}
|
||||
$data->[1] = $d; # insert end data at [1]
|
||||
#print "#$method:", join(";",@$data), "\n";
|
||||
unshift(@$data, $method); # add method to start
|
||||
|
||||
push(@results, $data);
|
||||
$method = '';
|
||||
$data = [];
|
||||
} else {
|
||||
die "Can't parse: $_";
|
||||
}
|
||||
}
|
||||
|
||||
elsif (/^\[/) {
|
||||
if ($method) {
|
||||
push(@$data, $_);
|
||||
} else {
|
||||
# ignore extraneous GC notices
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
die "Can't parse: $_";
|
||||
}
|
||||
}
|
||||
|
||||
die "$method was begun but not finished" if ($method);
|
||||
|
||||
@results;
|
||||
}
|
||||
|
||||
#|#---------------------------------------------------------------------
|
||||
#|# Format a confidence interval, as given by a Dataset. Output is as
|
||||
#|# as follows:
|
||||
#|# 241.23 - 241.98 => 241.5 +/- 0.3
|
||||
#|# 241.2 - 243.8 => 242 +/- 1
|
||||
#|# 211.0 - 241.0 => 226 +/- 15 or? 230 +/- 20
|
||||
#|# 220.3 - 234.3 => 227 +/- 7
|
||||
#|# 220.3 - 300.3 => 260 +/- 40
|
||||
#|# 220.3 - 1000 => 610 +/- 390 or? 600 +/- 400
|
||||
#|# 0.022 - 0.024 => 0.023 +/- 0.001
|
||||
#|# 0.022 - 0.032 => 0.027 +/- 0.005
|
||||
#|# 0.022 - 1.000 => 0.5 +/- 0.5
|
||||
#|# In other words, take one significant digit of the error value and
|
||||
#|# display the mean to the same precision.
|
||||
#|sub formatDataset {
|
||||
#| my $ds = shift;
|
||||
#| my $lower = $ds->getMean() - $ds->getError();
|
||||
#| my $upper = $ds->getMean() + $ds->getError();
|
||||
#| my $scale = 0;
|
||||
#| # Find how many initial digits are the same
|
||||
#| while ($lower < 1 ||
|
||||
#| int($lower) == int($upper)) {
|
||||
#| $lower *= 10;
|
||||
#| $upper *= 10;
|
||||
#| $scale++;
|
||||
#| }
|
||||
#| while ($lower >= 10 &&
|
||||
#| int($lower) == int($upper)) {
|
||||
#| $lower /= 10;
|
||||
#| $upper /= 10;
|
||||
#| $scale--;
|
||||
#| }
|
||||
#|}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Format a number, optionally with a +/- delta, to n significant
|
||||
# digits.
|
||||
#
|
||||
# @param significant digit, a value >= 1
|
||||
# @param multiplier
|
||||
# @param time in seconds to be formatted
|
||||
# @optional delta in seconds
|
||||
#
|
||||
# @return string of the form "23" or "23 +/- 10".
|
||||
#
|
||||
sub formatNumber {
|
||||
my $sigdig = shift;
|
||||
my $mult = shift;
|
||||
my $a = shift;
|
||||
my $delta = shift; # may be undef
|
||||
|
||||
my $result = formatSigDig($sigdig, $a*$mult);
|
||||
if (defined($delta)) {
|
||||
my $d = formatSigDig($sigdig, $delta*$mult);
|
||||
# restrict PRECISION of delta to that of main number
|
||||
if ($result =~ /\.(\d+)/) {
|
||||
# TODO make this work for values with all significant
|
||||
# digits to the left of the decimal, e.g., 1234000.
|
||||
|
||||
# TODO the other thing wrong with this is that it
|
||||
# isn't rounding the $delta properly. Have to put
|
||||
# this logic into formatSigDig().
|
||||
my $x = length($1);
|
||||
$d =~ s/\.(\d{$x})\d+/.$1/;
|
||||
}
|
||||
$result .= " $PLUS_MINUS " . $d;
|
||||
}
|
||||
$result;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Format a time, optionally with a +/- delta, to n significant
|
||||
# digits.
|
||||
#
|
||||
# @param significant digit, a value >= 1
|
||||
# @param time in seconds to be formatted
|
||||
# @optional delta in seconds
|
||||
#
|
||||
# @return string of the form "23 ms" or "23 +/- 10 ms".
|
||||
#
|
||||
sub formatSeconds {
|
||||
my $sigdig = shift;
|
||||
my $a = shift;
|
||||
my $delta = shift; # may be undef
|
||||
|
||||
my @MULT = (1 , 1e3, 1e6, 1e9);
|
||||
my @SUFF = ('s' , 'ms', 'us', 'ns');
|
||||
|
||||
# Determine our scale
|
||||
my $i = 0;
|
||||
++$i while ($a*$MULT[$i] < 1 && $i < @MULT);
|
||||
|
||||
formatNumber($sigdig, $MULT[$i], $a, $delta) . ' ' . $SUFF[$i];
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Format a percentage, optionally with a +/- delta, to n significant
|
||||
# digits.
|
||||
#
|
||||
# @param significant digit, a value >= 1
|
||||
# @param value to be formatted, as a fraction, e.g. 0.5 for 50%
|
||||
# @optional delta, as a fraction
|
||||
#
|
||||
# @return string of the form "23 %" or "23 +/- 10 %".
|
||||
#
|
||||
sub formatPercent {
|
||||
my $sigdig = shift;
|
||||
my $a = shift;
|
||||
my $delta = shift; # may be undef
|
||||
|
||||
formatNumber($sigdig, 100, $a, $delta) . ' %';
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Format a number to n significant digits without using exponential
|
||||
# notation.
|
||||
#
|
||||
# @param significant digit, a value >= 1
|
||||
# @param number to be formatted
|
||||
#
|
||||
# @return string of the form "1234" "12.34" or "0.001234". If
|
||||
# number was negative, prefixed by '-'.
|
||||
#
|
||||
sub formatSigDig {
|
||||
my $n = shift() - 1;
|
||||
my $a = shift;
|
||||
|
||||
local $_ = sprintf("%.${n}e", $a);
|
||||
my $sign = (s/^-//) ? '-' : '';
|
||||
|
||||
my $a_e;
|
||||
my $result;
|
||||
if (/^(\d)\.(\d+)e([-+]\d+)$/) {
|
||||
my ($d, $dn, $e) = ($1, $2, $3);
|
||||
$a_e = $e;
|
||||
$d .= $dn;
|
||||
$e++;
|
||||
$d .= '0' while ($e > length($d));
|
||||
while ($e < 1) {
|
||||
$e++;
|
||||
$d = '0' . $d;
|
||||
}
|
||||
if ($e == length($d)) {
|
||||
$result = $sign . $d;
|
||||
} else {
|
||||
$result = $sign . substr($d, 0, $e) . '.' . substr($d, $e);
|
||||
}
|
||||
} else {
|
||||
die "Can't parse $_";
|
||||
}
|
||||
$result;
|
||||
}
|
||||
|
||||
#eof
|
||||
#!/usr/local/bin/perl
|
||||
# *******************************************************************************
|
||||
# * Copyright (C) 2002-2007 International Business Machines Corporation and *
|
||||
# * others. All Rights Reserved. *
|
||||
# *******************************************************************************
|
||||
|
||||
use strict;
|
||||
|
||||
# Assume we are running within the icu4j root directory
|
||||
use lib 'src/com/ibm/icu/dev/test/perf';
|
||||
use Dataset;
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Test class
|
||||
my $TESTCLASS = 'com.ibm.icu.dev.test.perf.DecimalFormatPerformanceTest';
|
||||
|
||||
# Methods to be tested. Each pair represents a test method and
|
||||
# a baseline method which is used for comparison.
|
||||
my @METHODS = (
|
||||
['TestJDKConstruction', 'TestICUConstruction'],
|
||||
['TestJDKParse', 'TestICUParse'],
|
||||
['TestJDKFormat', 'TestICUFormat']
|
||||
);
|
||||
# Patterns which define the set of characters used for testing.
|
||||
my @OPTIONS = (
|
||||
# locale pattern date string
|
||||
[ "en_US", "#,###.##", "1,234.56"],
|
||||
[ "de_DE", "#,###.##", "1.234,56"],
|
||||
);
|
||||
|
||||
my $THREADS; # number of threads (input from command-line args)
|
||||
my $CALIBRATE = 2; # duration in seconds for initial calibration
|
||||
my $DURATION = 10; # duration in seconds for each pass
|
||||
my $NUMPASSES = 4; # number of passes. If > 1 then the first pass
|
||||
# is discarded as a JIT warm-up pass.
|
||||
|
||||
my $TABLEATTR = 'BORDER="1" CELLPADDING="4" CELLSPACING="0"';
|
||||
|
||||
my $PLUS_MINUS = "±";
|
||||
|
||||
if ($NUMPASSES < 3) {
|
||||
die "Need at least 3 passes. One is discarded (JIT warmup) and need two to have 1 degree of freedom (t distribution).";
|
||||
}
|
||||
|
||||
my $OUT; # see out()
|
||||
|
||||
# run all tests with the specified number of threads from command-line input
|
||||
# (if there is no arguments, use $THREADS = 1)
|
||||
foreach my $arg ($#ARGV >= 0 ? @ARGV : "1") {
|
||||
$THREADS = $arg;
|
||||
main();
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# ...
|
||||
sub main {
|
||||
my $date = localtime;
|
||||
my $threads = ($THREADS > 1) ? "($THREADS threads)" : "";
|
||||
my $title = "ICU4J Performance Test $threads $date";
|
||||
|
||||
my $html = $date;
|
||||
$html =~ s/://g; # ':' illegal
|
||||
$html =~ s/\s*\d+$//; # delete year
|
||||
$html =~ s/^\w+\s*//; # delete dow
|
||||
$html = "perf $html.html";
|
||||
|
||||
open(HTML,">$html") or die "Can't write to $html: $!";
|
||||
|
||||
print HTML <<EOF;
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>$title</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
EOF
|
||||
print HTML "<H1>$title</H1>\n";
|
||||
|
||||
print HTML "<H2>$TESTCLASS</H2>\n";
|
||||
|
||||
my $raw = "";
|
||||
|
||||
for my $methodPair (@METHODS) {
|
||||
|
||||
my $testMethod = $methodPair->[0];
|
||||
my $baselineMethod = $methodPair->[1];
|
||||
|
||||
print HTML "<P><TABLE $TABLEATTR><TR><TD>\n";
|
||||
print HTML "<P><B>$testMethod vs. $baselineMethod</B></P>\n";
|
||||
|
||||
print HTML "<P><TABLE $TABLEATTR BGCOLOR=\"#CCFFFF\">\n";
|
||||
print HTML "<TR><TD>Options</TD><TD>$testMethod</TD>";
|
||||
print HTML "<TD>$baselineMethod</TD><TD>Ratio</TD></TR>\n";
|
||||
$OUT = '';
|
||||
|
||||
for my $pat (@OPTIONS) {
|
||||
print HTML "<TR><TD>@$pat[0], \"@$pat[1]\", \"@$pat[2]\"</TD>\n";
|
||||
|
||||
out("<P><TABLE $TABLEATTR WIDTH=\"100%\">");
|
||||
|
||||
# measure the test method
|
||||
out("<TR><TD>");
|
||||
print "\n$testMethod [@$pat]\n";
|
||||
my $t = measure2($testMethod, $pat, -$DURATION);
|
||||
out("</TD></TR>");
|
||||
print HTML "<TD>", formatSeconds(4, $t->getMean(), $t->getError);
|
||||
print HTML "/event</TD>\n";
|
||||
|
||||
# measure baseline method
|
||||
out("<TR><TD>");
|
||||
print "\n$baselineMethod [@$pat]\n";
|
||||
my $b = measure2($baselineMethod, $pat, -$DURATION);
|
||||
out("</TD></TR>");
|
||||
print HTML "<TD>", formatSeconds(4, $b->getMean(), $t->getError);
|
||||
print HTML "/event</TD>\n";
|
||||
|
||||
out("</TABLE></P>");
|
||||
|
||||
# output ratio
|
||||
my $r = $t->divide($b);
|
||||
my $mean = $r->getMean() - 1;
|
||||
my $color = $mean < 0 ? "RED" : "BLACK";
|
||||
print HTML "<TD><B><FONT COLOR=\"$color\">", formatPercent(3, $mean, $r->getError);
|
||||
print HTML "</FONT></B></TD></TR>\n";
|
||||
}
|
||||
|
||||
print HTML "</TABLE></P>\n";
|
||||
|
||||
print HTML "<P>Raw data:</P>\n";
|
||||
print HTML $OUT;
|
||||
print HTML "</TABLE></P>\n";
|
||||
}
|
||||
|
||||
print HTML <<EOF;
|
||||
</BODY>
|
||||
</HTML>
|
||||
EOF
|
||||
close(HTML) or die "Can't close $html: $!";
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Append text to the global variable $OUT
|
||||
sub out {
|
||||
$OUT .= join('', @_);
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Append text to the global variable $OUT
|
||||
sub outln {
|
||||
$OUT .= join('', @_) . "\n";
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Measure a given test method with a give test pattern using the
|
||||
# global run parameters.
|
||||
#
|
||||
# @param the method to run
|
||||
# @param the pattern defining characters to test
|
||||
# @param if >0 then the number of iterations per pass. If <0 then
|
||||
# (negative of) the number of seconds per pass.
|
||||
#
|
||||
# @return a Dataset object, scaled by iterations per pass and
|
||||
# events per iteration, to give time per event
|
||||
#
|
||||
sub measure2 {
|
||||
my @data = measure1(@_);
|
||||
my $iterPerPass = shift(@data);
|
||||
my $eventPerIter = shift(@data);
|
||||
|
||||
shift(@data) if (@data > 1); # discard first run
|
||||
|
||||
my $ds = Dataset->new(@data);
|
||||
$ds->setScale(1.0e-3 / ($iterPerPass * $eventPerIter));
|
||||
$ds;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Measure a given test method with a give test pattern using the
|
||||
# global run parameters.
|
||||
#
|
||||
# @param the method to run
|
||||
# @param the pattern defining characters to test
|
||||
# @param if >0 then the number of iterations per pass. If <0 then
|
||||
# (negative of) the number of seconds per pass.
|
||||
#
|
||||
# @return array of:
|
||||
# [0] iterations per pass
|
||||
# [1] events per iteration
|
||||
# [2..] ms reported for each pass, in order
|
||||
#
|
||||
sub measure1 {
|
||||
my $method = shift;
|
||||
my $pat = shift;
|
||||
my $iterCount = shift; # actually might be -seconds/pass
|
||||
|
||||
out("<P>Measuring $method for input file @$pat[0] for encoding @$pat[2] , ");
|
||||
if ($iterCount > 0) {
|
||||
out("$iterCount iterations/pass, $NUMPASSES passes</P>\n");
|
||||
} else {
|
||||
out(-$iterCount, " seconds/pass, $NUMPASSES passes</P>\n");
|
||||
}
|
||||
|
||||
# is $iterCount actually -seconds/pass?
|
||||
if ($iterCount < 0) {
|
||||
|
||||
# calibrate: estimate ms/iteration
|
||||
print "Calibrating...";
|
||||
my @t = callJava($method, $pat, -$CALIBRATE, 1);
|
||||
print "done.\n";
|
||||
|
||||
my @data = split(/\s+/, $t[0]->[2]);
|
||||
$data[0] *= 1.0e+3;
|
||||
|
||||
my $timePerIter = 1.0e-3 * $data[0] / $data[1];
|
||||
|
||||
# determine iterations/pass
|
||||
$iterCount = int(-$iterCount / $timePerIter + 0.5);
|
||||
|
||||
out("<P>Calibration pass ($CALIBRATE sec): ");
|
||||
out("$data[0] ms, ");
|
||||
out("$data[1] iterations = ");
|
||||
out(formatSeconds(4, $timePerIter), "/iteration<BR>\n");
|
||||
}
|
||||
|
||||
# run passes
|
||||
print "Measuring $iterCount iterations x $NUMPASSES passes...";
|
||||
my @t = callJava($method, $pat, $iterCount, $NUMPASSES);
|
||||
print "done.\n";
|
||||
my @ms = ();
|
||||
my @b; # scratch
|
||||
for my $a (@t) {
|
||||
# $a->[0]: method name, corresponds to $method
|
||||
# $a->[1]: 'begin' data, == $iterCount
|
||||
# $a->[2]: 'end' data, of the form <ms> <loops> <eventsPerIter>
|
||||
# $a->[3...]: gc messages from JVM during pass
|
||||
@b = split(/\s+/, $a->[2]);
|
||||
push(@ms, $b[0] * 1.0e+3);
|
||||
}
|
||||
my $eventsPerIter = $b[2];
|
||||
|
||||
out("Iterations per pass: $iterCount<BR>\n");
|
||||
out("Events per iteration: $eventsPerIter<BR>\n");
|
||||
|
||||
my @ms_str = @ms;
|
||||
$ms_str[0] .= " (discarded)" if (@ms_str > 1);
|
||||
out("Raw times (ms/pass): ", join(", ", @ms_str), "<BR>\n");
|
||||
|
||||
($iterCount, $eventsPerIter, @ms);
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Invoke java to run $TESTCLASS, passing it the given parameters.
|
||||
#
|
||||
# @param the method to run
|
||||
# @param the number of iterations, or if negative, the duration
|
||||
# in seconds. If more than on pass is desired, pass in
|
||||
# a string, e.g., "100 100 100".
|
||||
# @param the pattern defining characters to test
|
||||
#
|
||||
# @return an array of results. Each result is an array REF
|
||||
# describing one pass. The array REF contains:
|
||||
# ->[0]: The method name as reported
|
||||
# ->[1]: The params on the '= <meth> begin ...' line
|
||||
# ->[2]: The params on the '= <meth> end ...' line
|
||||
# ->[3..]: GC messages from the JVM, if any
|
||||
#
|
||||
sub callJava {
|
||||
my $method = shift;
|
||||
my $pat = shift;
|
||||
my $n = shift;
|
||||
my $passes = shift;
|
||||
|
||||
my $n = ($n < 0) ? "-t ".(-$n) : "-i ".$n;
|
||||
|
||||
my $cmd = "java -classpath classes $TESTCLASS $method $n -p $passes -L @$pat[0] \"@$pat[1]\" \"@$pat[2]\" -r $THREADS";
|
||||
print "[$cmd]\n"; # for debugging
|
||||
open(PIPE, "$cmd|") or die "Can't run \"$cmd\"";
|
||||
my @out;
|
||||
while (<PIPE>) {
|
||||
push(@out, $_);
|
||||
}
|
||||
close(PIPE) or die "Java failed: \"$cmd\"";
|
||||
|
||||
@out = grep(!/^\#/, @out); # filter out comments
|
||||
|
||||
#print "[", join("\n", @out), "]\n";
|
||||
|
||||
my @results;
|
||||
my $method = '';
|
||||
my $data = [];
|
||||
foreach (@out) {
|
||||
next unless (/\S/);
|
||||
|
||||
if (/^=\s*(\w+)\s*(\w+)\s*(.*)/) {
|
||||
my ($m, $state, $d) = ($1, $2, $3);
|
||||
#print "$_ => [[$m $state $data]]\n";
|
||||
if ($state eq 'begin') {
|
||||
die "$method was begun but not finished" if ($method);
|
||||
$method = $m;
|
||||
push(@$data, $d);
|
||||
push(@$data, ''); # placeholder for end data
|
||||
} elsif ($state eq 'end') {
|
||||
if ($m ne $method) {
|
||||
die "$method end does not match: $_";
|
||||
}
|
||||
$data->[1] = $d; # insert end data at [1]
|
||||
#print "#$method:", join(";",@$data), "\n";
|
||||
unshift(@$data, $method); # add method to start
|
||||
|
||||
push(@results, $data);
|
||||
$method = '';
|
||||
$data = [];
|
||||
} else {
|
||||
die "Can't parse: $_";
|
||||
}
|
||||
}
|
||||
|
||||
elsif (/^\[/) {
|
||||
if ($method) {
|
||||
push(@$data, $_);
|
||||
} else {
|
||||
# ignore extraneous GC notices
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
die "Can't parse: $_";
|
||||
}
|
||||
}
|
||||
|
||||
die "$method was begun but not finished" if ($method);
|
||||
|
||||
@results;
|
||||
}
|
||||
|
||||
#|#---------------------------------------------------------------------
|
||||
#|# Format a confidence interval, as given by a Dataset. Output is as
|
||||
#|# as follows:
|
||||
#|# 241.23 - 241.98 => 241.5 +/- 0.3
|
||||
#|# 241.2 - 243.8 => 242 +/- 1
|
||||
#|# 211.0 - 241.0 => 226 +/- 15 or? 230 +/- 20
|
||||
#|# 220.3 - 234.3 => 227 +/- 7
|
||||
#|# 220.3 - 300.3 => 260 +/- 40
|
||||
#|# 220.3 - 1000 => 610 +/- 390 or? 600 +/- 400
|
||||
#|# 0.022 - 0.024 => 0.023 +/- 0.001
|
||||
#|# 0.022 - 0.032 => 0.027 +/- 0.005
|
||||
#|# 0.022 - 1.000 => 0.5 +/- 0.5
|
||||
#|# In other words, take one significant digit of the error value and
|
||||
#|# display the mean to the same precision.
|
||||
#|sub formatDataset {
|
||||
#| my $ds = shift;
|
||||
#| my $lower = $ds->getMean() - $ds->getError();
|
||||
#| my $upper = $ds->getMean() + $ds->getError();
|
||||
#| my $scale = 0;
|
||||
#| # Find how many initial digits are the same
|
||||
#| while ($lower < 1 ||
|
||||
#| int($lower) == int($upper)) {
|
||||
#| $lower *= 10;
|
||||
#| $upper *= 10;
|
||||
#| $scale++;
|
||||
#| }
|
||||
#| while ($lower >= 10 &&
|
||||
#| int($lower) == int($upper)) {
|
||||
#| $lower /= 10;
|
||||
#| $upper /= 10;
|
||||
#| $scale--;
|
||||
#| }
|
||||
#|}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Format a number, optionally with a +/- delta, to n significant
|
||||
# digits.
|
||||
#
|
||||
# @param significant digit, a value >= 1
|
||||
# @param multiplier
|
||||
# @param time in seconds to be formatted
|
||||
# @optional delta in seconds
|
||||
#
|
||||
# @return string of the form "23" or "23 +/- 10".
|
||||
#
|
||||
sub formatNumber {
|
||||
my $sigdig = shift;
|
||||
my $mult = shift;
|
||||
my $a = shift;
|
||||
my $delta = shift; # may be undef
|
||||
|
||||
my $result = formatSigDig($sigdig, $a*$mult);
|
||||
if (defined($delta)) {
|
||||
my $d = formatSigDig($sigdig, $delta*$mult);
|
||||
# restrict PRECISION of delta to that of main number
|
||||
if ($result =~ /\.(\d+)/) {
|
||||
# TODO make this work for values with all significant
|
||||
# digits to the left of the decimal, e.g., 1234000.
|
||||
|
||||
# TODO the other thing wrong with this is that it
|
||||
# isn't rounding the $delta properly. Have to put
|
||||
# this logic into formatSigDig().
|
||||
my $x = length($1);
|
||||
$d =~ s/\.(\d{$x})\d+/.$1/;
|
||||
}
|
||||
$result .= " $PLUS_MINUS " . $d;
|
||||
}
|
||||
$result;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Format a time, optionally with a +/- delta, to n significant
|
||||
# digits.
|
||||
#
|
||||
# @param significant digit, a value >= 1
|
||||
# @param time in seconds to be formatted
|
||||
# @optional delta in seconds
|
||||
#
|
||||
# @return string of the form "23 ms" or "23 +/- 10 ms".
|
||||
#
|
||||
sub formatSeconds {
|
||||
my $sigdig = shift;
|
||||
my $a = shift;
|
||||
my $delta = shift; # may be undef
|
||||
|
||||
my @MULT = (1 , 1e3, 1e6, 1e9);
|
||||
my @SUFF = ('s' , 'ms', 'us', 'ns');
|
||||
|
||||
# Determine our scale
|
||||
my $i = 0;
|
||||
++$i while ($a*$MULT[$i] < 1 && $i < @MULT);
|
||||
|
||||
formatNumber($sigdig, $MULT[$i], $a, $delta) . ' ' . $SUFF[$i];
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Format a percentage, optionally with a +/- delta, to n significant
|
||||
# digits.
|
||||
#
|
||||
# @param significant digit, a value >= 1
|
||||
# @param value to be formatted, as a fraction, e.g. 0.5 for 50%
|
||||
# @optional delta, as a fraction
|
||||
#
|
||||
# @return string of the form "23 %" or "23 +/- 10 %".
|
||||
#
|
||||
sub formatPercent {
|
||||
my $sigdig = shift;
|
||||
my $a = shift;
|
||||
my $delta = shift; # may be undef
|
||||
|
||||
formatNumber($sigdig, 100, $a, $delta) . ' %';
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Format a number to n significant digits without using exponential
|
||||
# notation.
|
||||
#
|
||||
# @param significant digit, a value >= 1
|
||||
# @param number to be formatted
|
||||
#
|
||||
# @return string of the form "1234" "12.34" or "0.001234". If
|
||||
# number was negative, prefixed by '-'.
|
||||
#
|
||||
sub formatSigDig {
|
||||
my $n = shift() - 1;
|
||||
my $a = shift;
|
||||
|
||||
local $_ = sprintf("%.${n}e", $a);
|
||||
my $sign = (s/^-//) ? '-' : '';
|
||||
|
||||
my $a_e;
|
||||
my $result;
|
||||
if (/^(\d)\.(\d+)e([-+]\d+)$/) {
|
||||
my ($d, $dn, $e) = ($1, $2, $3);
|
||||
$a_e = $e;
|
||||
$d .= $dn;
|
||||
$e++;
|
||||
$d .= '0' while ($e > length($d));
|
||||
while ($e < 1) {
|
||||
$e++;
|
||||
$d = '0' . $d;
|
||||
}
|
||||
if ($e == length($d)) {
|
||||
$result = $sign . $d;
|
||||
} else {
|
||||
$result = $sign . substr($d, 0, $e) . '.' . substr($d, $e);
|
||||
}
|
||||
} else {
|
||||
die "Can't parse $_";
|
||||
}
|
||||
$result;
|
||||
}
|
||||
|
||||
#eof
|
||||
|
|
166
src/com/ibm/icu/dev/test/perf/normalizationperf_r_b.pl
Normal file → Executable file
166
src/com/ibm/icu/dev/test/perf/normalizationperf_r_b.pl
Normal file → Executable file
|
@ -1,83 +1,83 @@
|
|||
#!/usr/bin/perl
|
||||
# ********************************************************************
|
||||
# * COPYRIGHT:
|
||||
# * Copyright (c) 2002-2007, International Business Machines
|
||||
# * Corporation and others. All Rights Reserved.
|
||||
# ********************************************************************
|
||||
|
||||
use strict;
|
||||
|
||||
#Assume we are running outside of the ICU4J source
|
||||
use lib 'svn-icu4j/src/com/ibm/icu/dev/test/perf/perldriver';
|
||||
|
||||
use PerfFramework4j;
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Test class
|
||||
my $TESTCLASS = 'com.ibm.icu.dev.test.perf.NormalizerPerformanceTest';
|
||||
|
||||
my $options = {
|
||||
"title"=>"Normalization performance regression (ICU4J 3.6 and 3.8)",
|
||||
"headers"=>"ICU4J36 ICU4J38",
|
||||
"operationIs"=>"code point",
|
||||
"timePerOperationIs"=>"Time per code point",
|
||||
"passes"=>"10",
|
||||
"time"=>"5",
|
||||
"outputType"=>"HTML",
|
||||
"dataDir"=>"C:\\svn-icu4j\\src\\com\\ibm\\icu\\dev\\test\\perf\\data\\collation",
|
||||
"outputDir"=>"svn-icu4j\\results_ICU4J"
|
||||
};
|
||||
|
||||
# programs
|
||||
|
||||
my $jvm1 = "java -cp svn-icu4j_3-6/classes $TESTCLASS -b -e UTF-8";
|
||||
my $jvm2 = "java -cp svn-icu4j/classes $TESTCLASS -b -e UTF-8";
|
||||
|
||||
my $dataFiles = {
|
||||
"",
|
||||
[
|
||||
"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",
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
my $tests = {
|
||||
# "NFC_NFD_Text", ["$jvm1 TestICU_NFC_NFD_Text" , "$jvm2 TestICU_NFC_NFD_Text" ],
|
||||
"NFC_NFC_Text", ["$jvm1 TestICU_NFC_NFC_Text" , "$jvm2 TestICU_NFC_NFC_Text" ],
|
||||
"NFC_Orig_Text", ["$jvm1 TestICU_NFC_Orig_Text" , "$jvm2 TestICU_NFC_Orig_Text"],
|
||||
"NFD_NFD_Text", ["$jvm1 TestICU_NFD_NFD_Text" , "$jvm2 TestICU_NFD_NFD_Text" ],
|
||||
"NFD_NFC_Text", ["$jvm1 TestICU_NFD_NFC_Text" , "$jvm2 TestICU_NFD_NFC_Text" ],
|
||||
"NFD_Orig_Text", ["$jvm1 TestICU_NFD_Orig_Text" , "$jvm2 TestICU_NFD_Orig_Text"],
|
||||
##
|
||||
"QC_NFC_NFD_Text", ["$jvm1 TestQC_NFC_NFD_Text" , "$jvm2 TestQC_NFC_NFD_Text" ],
|
||||
"QC_NFC_NFC_Text", ["$jvm1 TestQC_NFC_NFC_Text" , "$jvm2 TestQC_NFC_NFC_Text" ],
|
||||
"QC_NFC_Orig_Text", ["$jvm1 TestQC_NFC_Orig_Text" , "$jvm2 TestQC_NFC_Orig_Text"],
|
||||
"QC_NFD_NFD_Text", ["$jvm1 TestQC_NFD_NFD_Text" , "$jvm2 TestQC_NFD_NFD_Text" ],
|
||||
"QC_NFD_NFC_Text", ["$jvm1 TestQC_NFD_NFC_Text" , "$jvm2 TestQC_NFD_NFC_Text" ],
|
||||
"QC_NFD_Orig_Text", ["$jvm1 TestQC_NFD_Orig_Text" , "$jvm2 TestQC_NFD_Orig_Text"],
|
||||
##
|
||||
"IsNormalized_NFC_NFD_Text", ["$jvm1 TestIsNormalized_NFC_NFD_Text" , "$jvm2 TestIsNormalized_NFC_NFD_Text" ],
|
||||
"IsNormalized_NFC_NFC_Text", ["$jvm1 TestIsNormalized_NFC_NFC_Text" , "$jvm2 TestIsNormalized_NFC_NFC_Text" ],
|
||||
"IsNormalized_NFC_Orig_Text", ["$jvm1 TestIsNormalized_NFC_Orig_Text" , "$jvm2 TestIsNormalized_NFC_Orig_Text"],
|
||||
"IsNormalized_NFD_NFD_Text", ["$jvm1 TestIsNormalized_NFD_NFD_Text" , "$jvm2 TestIsNormalized_NFD_NFD_Text" ],
|
||||
"IsNormalized_NFD_NFC_Text", ["$jvm1 TestIsNormalized_NFD_NFC_Text" , "$jvm2 TestIsNormalized_NFD_NFC_Text" ],
|
||||
"IsNormalized_NFD_Orig_Text", ["$jvm1 TestIsNormalized_NFD_Orig_Text" , "$jvm2 TestIsNormalized_NFD_Orig_Text"]
|
||||
};
|
||||
|
||||
|
||||
runTests($options, $tests, $dataFiles);
|
||||
|
||||
|
||||
#!/usr/bin/perl
|
||||
# ********************************************************************
|
||||
# * COPYRIGHT:
|
||||
# * Copyright (c) 2002-2007, International Business Machines
|
||||
# * Corporation and others. All Rights Reserved.
|
||||
# ********************************************************************
|
||||
|
||||
use strict;
|
||||
|
||||
#Assume we are running outside of the ICU4J source
|
||||
use lib 'svn-icu4j/src/com/ibm/icu/dev/test/perf/perldriver';
|
||||
|
||||
use PerfFramework4j;
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Test class
|
||||
my $TESTCLASS = 'com.ibm.icu.dev.test.perf.NormalizerPerformanceTest';
|
||||
|
||||
my $options = {
|
||||
"title"=>"Normalization performance regression (ICU4J 3.6 and 3.8)",
|
||||
"headers"=>"ICU4J36 ICU4J38",
|
||||
"operationIs"=>"code point",
|
||||
"timePerOperationIs"=>"Time per code point",
|
||||
"passes"=>"10",
|
||||
"time"=>"5",
|
||||
"outputType"=>"HTML",
|
||||
"dataDir"=>"C:\\svn-icu4j\\src\\com\\ibm\\icu\\dev\\test\\perf\\data\\collation",
|
||||
"outputDir"=>"svn-icu4j\\results_ICU4J"
|
||||
};
|
||||
|
||||
# programs
|
||||
|
||||
my $jvm1 = "java -cp svn-icu4j_3-6/classes $TESTCLASS -b -e UTF-8";
|
||||
my $jvm2 = "java -cp svn-icu4j/classes $TESTCLASS -b -e UTF-8";
|
||||
|
||||
my $dataFiles = {
|
||||
"",
|
||||
[
|
||||
"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",
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
my $tests = {
|
||||
# "NFC_NFD_Text", ["$jvm1 TestICU_NFC_NFD_Text" , "$jvm2 TestICU_NFC_NFD_Text" ],
|
||||
"NFC_NFC_Text", ["$jvm1 TestICU_NFC_NFC_Text" , "$jvm2 TestICU_NFC_NFC_Text" ],
|
||||
"NFC_Orig_Text", ["$jvm1 TestICU_NFC_Orig_Text" , "$jvm2 TestICU_NFC_Orig_Text"],
|
||||
"NFD_NFD_Text", ["$jvm1 TestICU_NFD_NFD_Text" , "$jvm2 TestICU_NFD_NFD_Text" ],
|
||||
"NFD_NFC_Text", ["$jvm1 TestICU_NFD_NFC_Text" , "$jvm2 TestICU_NFD_NFC_Text" ],
|
||||
"NFD_Orig_Text", ["$jvm1 TestICU_NFD_Orig_Text" , "$jvm2 TestICU_NFD_Orig_Text"],
|
||||
##
|
||||
"QC_NFC_NFD_Text", ["$jvm1 TestQC_NFC_NFD_Text" , "$jvm2 TestQC_NFC_NFD_Text" ],
|
||||
"QC_NFC_NFC_Text", ["$jvm1 TestQC_NFC_NFC_Text" , "$jvm2 TestQC_NFC_NFC_Text" ],
|
||||
"QC_NFC_Orig_Text", ["$jvm1 TestQC_NFC_Orig_Text" , "$jvm2 TestQC_NFC_Orig_Text"],
|
||||
"QC_NFD_NFD_Text", ["$jvm1 TestQC_NFD_NFD_Text" , "$jvm2 TestQC_NFD_NFD_Text" ],
|
||||
"QC_NFD_NFC_Text", ["$jvm1 TestQC_NFD_NFC_Text" , "$jvm2 TestQC_NFD_NFC_Text" ],
|
||||
"QC_NFD_Orig_Text", ["$jvm1 TestQC_NFD_Orig_Text" , "$jvm2 TestQC_NFD_Orig_Text"],
|
||||
##
|
||||
"IsNormalized_NFC_NFD_Text", ["$jvm1 TestIsNormalized_NFC_NFD_Text" , "$jvm2 TestIsNormalized_NFC_NFD_Text" ],
|
||||
"IsNormalized_NFC_NFC_Text", ["$jvm1 TestIsNormalized_NFC_NFC_Text" , "$jvm2 TestIsNormalized_NFC_NFC_Text" ],
|
||||
"IsNormalized_NFC_Orig_Text", ["$jvm1 TestIsNormalized_NFC_Orig_Text" , "$jvm2 TestIsNormalized_NFC_Orig_Text"],
|
||||
"IsNormalized_NFD_NFD_Text", ["$jvm1 TestIsNormalized_NFD_NFD_Text" , "$jvm2 TestIsNormalized_NFD_NFD_Text" ],
|
||||
"IsNormalized_NFD_NFC_Text", ["$jvm1 TestIsNormalized_NFD_NFC_Text" , "$jvm2 TestIsNormalized_NFD_NFC_Text" ],
|
||||
"IsNormalized_NFD_Orig_Text", ["$jvm1 TestIsNormalized_NFD_Orig_Text" , "$jvm2 TestIsNormalized_NFD_Orig_Text"]
|
||||
};
|
||||
|
||||
|
||||
runTests($options, $tests, $dataFiles);
|
||||
|
||||
|
||||
|
|
166
src/com/ibm/icu/dev/test/perf/normalizationperf_r_l.pl
Normal file → Executable file
166
src/com/ibm/icu/dev/test/perf/normalizationperf_r_l.pl
Normal file → Executable file
|
@ -1,83 +1,83 @@
|
|||
#!/usr/bin/perl
|
||||
# ********************************************************************
|
||||
# * COPYRIGHT:
|
||||
# * Copyright (c) 2002-2007, International Business Machines
|
||||
# * Corporation and others. All Rights Reserved.
|
||||
# ********************************************************************
|
||||
|
||||
use strict;
|
||||
|
||||
#Assume we are running outside of the ICU4J source
|
||||
use lib './icu4jsrc_3_4/src/com/ibm/icu/dev/test/perf/perldriver';
|
||||
|
||||
use PerfFramework4j;
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Test class
|
||||
my $TESTCLASS = 'com.ibm.icu.dev.test.perf.NormalizerPerformanceTest';
|
||||
|
||||
my $options = {
|
||||
"title"=>"Normalization performance regression (ICU4J 3.2 and 3.4)",
|
||||
"headers"=>"ICU4J32 ICU4J34",
|
||||
"operationIs"=>"code point",
|
||||
"timePerOperationIs"=>"Time per code point",
|
||||
"passes"=>"10",
|
||||
"time"=>"5",
|
||||
#"outputType"=>"HTML",
|
||||
"dataDir"=>"c:\\src\\perf\\data",
|
||||
"outputDir"=>"results_ICU4J"
|
||||
};
|
||||
|
||||
# programs
|
||||
|
||||
my $jvm1 = "java -cp ./icu4jsrc_3_2/icu4j32.jar;./icu4jsrc_3_2/perf32.jar $TESTCLASS -l -e UTF-8";
|
||||
my $jvm2 = "java -cp ./icu4jsrc_3_4/icu4j34.jar;./icu4jsrc_3_4/perf34.jar $TESTCLASS -l -e UTF-8";
|
||||
|
||||
my $dataFiles = {
|
||||
"",
|
||||
[
|
||||
"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",
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
my $tests = {
|
||||
"NFC_NFD_Text", ["$jvm1 TestICU_NFC_NFD_Text" , "$jvm2 TestICU_NFC_NFD_Text" ],
|
||||
"NFC_NFC_Text", ["$jvm1 TestICU_NFC_NFC_Text" , "$jvm2 TestICU_NFC_NFC_Text" ],
|
||||
"NFC_Orig_Text", ["$jvm1 TestICU_NFC_Orig_Text" , "$jvm2 TestICU_NFC_Orig_Text"],
|
||||
"NFD_NFD_Text", ["$jvm1 TestICU_NFD_NFD_Text" , "$jvm2 TestICU_NFD_NFD_Text" ],
|
||||
"NFD_NFC_Text", ["$jvm1 TestICU_NFD_NFC_Text" , "$jvm2 TestICU_NFD_NFC_Text" ],
|
||||
"NFD_Orig_Text", ["$jvm1 TestICU_NFD_Orig_Text" , "$jvm2 TestICU_NFD_Orig_Text"],
|
||||
##
|
||||
"QC_NFC_NFD_Text", ["$jvm1 TestQC_NFC_NFD_Text" , "$jvm2 TestQC_NFC_NFD_Text" ],
|
||||
"QC_NFC_NFC_Text", ["$jvm1 TestQC_NFC_NFC_Text" , "$jvm2 TestQC_NFC_NFC_Text" ],
|
||||
"QC_NFC_Orig_Text", ["$jvm1 TestQC_NFC_Orig_Text" , "$jvm2 TestQC_NFC_Orig_Text"],
|
||||
"QC_NFD_NFD_Text", ["$jvm1 TestQC_NFD_NFD_Text" , "$jvm2 TestQC_NFD_NFD_Text" ],
|
||||
"QC_NFD_NFC_Text", ["$jvm1 TestQC_NFD_NFC_Text" , "$jvm2 TestQC_NFD_NFC_Text" ],
|
||||
"QC_NFD_Orig_Text", ["$jvm1 TestQC_NFD_Orig_Text" , "$jvm2 TestQC_NFD_Orig_Text"],
|
||||
##
|
||||
"IsNormalized_NFC_NFD_Text", ["$jvm1 TestIsNormalized_NFC_NFD_Text" , "$jvm2 TestIsNormalized_NFC_NFD_Text" ],
|
||||
"IsNormalized_NFC_NFC_Text", ["$jvm1 TestIsNormalized_NFC_NFC_Text" , "$jvm2 TestIsNormalized_NFC_NFC_Text" ],
|
||||
"IsNormalized_NFC_Orig_Text", ["$jvm1 TestIsNormalized_NFC_Orig_Text" , "$jvm2 TestIsNormalized_NFC_Orig_Text"],
|
||||
"IsNormalized_NFD_NFD_Text", ["$jvm1 TestIsNormalized_NFD_NFD_Text" , "$jvm2 TestIsNormalized_NFD_NFD_Text" ],
|
||||
"IsNormalized_NFD_NFC_Text", ["$jvm1 TestIsNormalized_NFD_NFC_Text" , "$jvm2 TestIsNormalized_NFD_NFC_Text" ],
|
||||
"IsNormalized_NFD_Orig_Text", ["$jvm1 TestIsNormalized_NFD_Orig_Text" , "$jvm2 TestIsNormalized_NFD_Orig_Text"]
|
||||
};
|
||||
|
||||
|
||||
runTests($options, $tests, $dataFiles);
|
||||
|
||||
|
||||
#!/usr/bin/perl
|
||||
# ********************************************************************
|
||||
# * COPYRIGHT:
|
||||
# * Copyright (c) 2002-2007, International Business Machines
|
||||
# * Corporation and others. All Rights Reserved.
|
||||
# ********************************************************************
|
||||
|
||||
use strict;
|
||||
|
||||
#Assume we are running outside of the ICU4J source
|
||||
use lib './icu4jsrc_3_4/src/com/ibm/icu/dev/test/perf/perldriver';
|
||||
|
||||
use PerfFramework4j;
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Test class
|
||||
my $TESTCLASS = 'com.ibm.icu.dev.test.perf.NormalizerPerformanceTest';
|
||||
|
||||
my $options = {
|
||||
"title"=>"Normalization performance regression (ICU4J 3.2 and 3.4)",
|
||||
"headers"=>"ICU4J32 ICU4J34",
|
||||
"operationIs"=>"code point",
|
||||
"timePerOperationIs"=>"Time per code point",
|
||||
"passes"=>"10",
|
||||
"time"=>"5",
|
||||
#"outputType"=>"HTML",
|
||||
"dataDir"=>"c:\\src\\perf\\data",
|
||||
"outputDir"=>"results_ICU4J"
|
||||
};
|
||||
|
||||
# programs
|
||||
|
||||
my $jvm1 = "java -cp ./icu4jsrc_3_2/icu4j32.jar;./icu4jsrc_3_2/perf32.jar $TESTCLASS -l -e UTF-8";
|
||||
my $jvm2 = "java -cp ./icu4jsrc_3_4/icu4j34.jar;./icu4jsrc_3_4/perf34.jar $TESTCLASS -l -e UTF-8";
|
||||
|
||||
my $dataFiles = {
|
||||
"",
|
||||
[
|
||||
"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",
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
my $tests = {
|
||||
"NFC_NFD_Text", ["$jvm1 TestICU_NFC_NFD_Text" , "$jvm2 TestICU_NFC_NFD_Text" ],
|
||||
"NFC_NFC_Text", ["$jvm1 TestICU_NFC_NFC_Text" , "$jvm2 TestICU_NFC_NFC_Text" ],
|
||||
"NFC_Orig_Text", ["$jvm1 TestICU_NFC_Orig_Text" , "$jvm2 TestICU_NFC_Orig_Text"],
|
||||
"NFD_NFD_Text", ["$jvm1 TestICU_NFD_NFD_Text" , "$jvm2 TestICU_NFD_NFD_Text" ],
|
||||
"NFD_NFC_Text", ["$jvm1 TestICU_NFD_NFC_Text" , "$jvm2 TestICU_NFD_NFC_Text" ],
|
||||
"NFD_Orig_Text", ["$jvm1 TestICU_NFD_Orig_Text" , "$jvm2 TestICU_NFD_Orig_Text"],
|
||||
##
|
||||
"QC_NFC_NFD_Text", ["$jvm1 TestQC_NFC_NFD_Text" , "$jvm2 TestQC_NFC_NFD_Text" ],
|
||||
"QC_NFC_NFC_Text", ["$jvm1 TestQC_NFC_NFC_Text" , "$jvm2 TestQC_NFC_NFC_Text" ],
|
||||
"QC_NFC_Orig_Text", ["$jvm1 TestQC_NFC_Orig_Text" , "$jvm2 TestQC_NFC_Orig_Text"],
|
||||
"QC_NFD_NFD_Text", ["$jvm1 TestQC_NFD_NFD_Text" , "$jvm2 TestQC_NFD_NFD_Text" ],
|
||||
"QC_NFD_NFC_Text", ["$jvm1 TestQC_NFD_NFC_Text" , "$jvm2 TestQC_NFD_NFC_Text" ],
|
||||
"QC_NFD_Orig_Text", ["$jvm1 TestQC_NFD_Orig_Text" , "$jvm2 TestQC_NFD_Orig_Text"],
|
||||
##
|
||||
"IsNormalized_NFC_NFD_Text", ["$jvm1 TestIsNormalized_NFC_NFD_Text" , "$jvm2 TestIsNormalized_NFC_NFD_Text" ],
|
||||
"IsNormalized_NFC_NFC_Text", ["$jvm1 TestIsNormalized_NFC_NFC_Text" , "$jvm2 TestIsNormalized_NFC_NFC_Text" ],
|
||||
"IsNormalized_NFC_Orig_Text", ["$jvm1 TestIsNormalized_NFC_Orig_Text" , "$jvm2 TestIsNormalized_NFC_Orig_Text"],
|
||||
"IsNormalized_NFD_NFD_Text", ["$jvm1 TestIsNormalized_NFD_NFD_Text" , "$jvm2 TestIsNormalized_NFD_NFD_Text" ],
|
||||
"IsNormalized_NFD_NFC_Text", ["$jvm1 TestIsNormalized_NFD_NFC_Text" , "$jvm2 TestIsNormalized_NFD_NFC_Text" ],
|
||||
"IsNormalized_NFD_Orig_Text", ["$jvm1 TestIsNormalized_NFD_Orig_Text" , "$jvm2 TestIsNormalized_NFD_Orig_Text"]
|
||||
};
|
||||
|
||||
|
||||
runTests($options, $tests, $dataFiles);
|
||||
|
||||
|
||||
|
|
176
src/com/ibm/icu/dev/test/perf/rbbiperf_r.pl
Normal file → Executable file
176
src/com/ibm/icu/dev/test/perf/rbbiperf_r.pl
Normal file → Executable file
|
@ -1,88 +1,88 @@
|
|||
#!/usr/bin/perl
|
||||
# ********************************************************************
|
||||
# * COPYRIGHT:
|
||||
# * Copyright (c) 2002-2007, International Business Machines
|
||||
# * Corporation and others. All Rights Reserved.
|
||||
# ********************************************************************
|
||||
|
||||
use strict;
|
||||
|
||||
use lib 'svn-icu4j/src/com/ibm/icu/dev/test/perf/perldriver';
|
||||
|
||||
use PerfFramework4j;
|
||||
|
||||
my $options = {
|
||||
"title"=>"Rule Based BreakIterator performance regression (ICU4J 3.6 and 3.8)",
|
||||
"headers"=>"ICU4J36 ICU4J38",
|
||||
"operationIs"=>"code point",
|
||||
"eventIs"=>"break",
|
||||
"passes"=>"10",
|
||||
"time"=>"5",
|
||||
"outputType"=>"HTML",
|
||||
"dataDir"=>"svn-icu4j/src/com/ibm/icu/dev/test/perf/data/collation",
|
||||
"outputDir"=>"svn-icu4j/results_ICU4J"
|
||||
};
|
||||
|
||||
# programs
|
||||
# Test class
|
||||
my $TESTCLASS = "com.ibm.icu.dev.test.perf.RBBIPerf";
|
||||
# tests will be done for all the programs. Results will be stored and connected
|
||||
my $m1 = "char";
|
||||
my $m2 = "word";
|
||||
my $m3 = "line";
|
||||
my $m4 = "jdkline";
|
||||
|
||||
my $m;
|
||||
|
||||
if(@_ >= 0) {
|
||||
$m = "-- -m ".shift;
|
||||
} else {
|
||||
$m = $m1;
|
||||
}
|
||||
|
||||
my $jvm1 = "java -classpath svn-icu4j_3-6/classes $TESTCLASS";
|
||||
my $jvm2 = "java -classpath svn-icu4j/classes $TESTCLASS";
|
||||
|
||||
my $dataFiles = {
|
||||
"en", [
|
||||
#"thesis.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_Latin.txt",
|
||||
"TestNames_SerbianSH.txt",
|
||||
"TestNames_SerbianSR.txt",
|
||||
"TestNames_Thai.txt",
|
||||
"Testnames_Russian.txt",
|
||||
],
|
||||
#"th", ["TestNames_Thai.txt", "th18057.txt"]
|
||||
};
|
||||
|
||||
|
||||
my $tests = {
|
||||
"TestNextChar", ["$jvm1 testRBBINext $m1", "$jvm2 testRBBINext $m1"],
|
||||
"TestNextWord", ["$jvm1 testRBBINext $m2", "$jvm2 testRBBINext $m2"],
|
||||
"TestNextLine", ["$jvm1 testRBBINext $m3", "$jvm2 testRBBINext $m3"],
|
||||
"TestNextJDKLine", ["$jvm1 testRBBINext $m4", "$jvm2 testRBBINext $m4"],
|
||||
##
|
||||
"TestPreviousChar", ["$jvm1 testRBBIPrevious $m1", "$jvm2 testRBBIPrevious $m1"],
|
||||
"TestPreviousWord", ["$jvm1 testRBBIPrevious $m2", "$jvm2 testRBBIPrevious $m2"],
|
||||
"TestPreviousLine", ["$jvm1 testRBBIPrevious $m3", "$jvm2 testRBBIPrevious $m3"],
|
||||
#"TestPreviousSentence", ["$jvm1 testRBBIPrevious $m4", "$jvm2 testRBBIPrevious $m4"],
|
||||
##
|
||||
"TestIsBoundaryChar", ["$jvm1 testRBBIIsBoundary $m1", "$jvm2 testRBBIIsBoundary $m1"],
|
||||
"TestIsBoundaryWord", ["$jvm1 testRBBIIsBoundary $m2", "$jvm2 testRBBIIsBoundary $m2"],
|
||||
"TestIsBoundaryLine", ["$jvm1 testRBBIIsBoundary $m3", "$jvm2 testRBBIIsBoundary $m3"],
|
||||
#"TestIsBoundarySentence", ["$jvm1 testRBBIIsBoundary $m4", "$jvm2 testRBBIIsBoundary $m4"],
|
||||
};
|
||||
|
||||
runTests($options, $tests, $dataFiles);
|
||||
|
||||
|
||||
#!/usr/bin/perl
|
||||
# ********************************************************************
|
||||
# * COPYRIGHT:
|
||||
# * Copyright (c) 2002-2007, International Business Machines
|
||||
# * Corporation and others. All Rights Reserved.
|
||||
# ********************************************************************
|
||||
|
||||
use strict;
|
||||
|
||||
use lib 'svn-icu4j/src/com/ibm/icu/dev/test/perf/perldriver';
|
||||
|
||||
use PerfFramework4j;
|
||||
|
||||
my $options = {
|
||||
"title"=>"Rule Based BreakIterator performance regression (ICU4J 3.6 and 3.8)",
|
||||
"headers"=>"ICU4J36 ICU4J38",
|
||||
"operationIs"=>"code point",
|
||||
"eventIs"=>"break",
|
||||
"passes"=>"10",
|
||||
"time"=>"5",
|
||||
"outputType"=>"HTML",
|
||||
"dataDir"=>"svn-icu4j/src/com/ibm/icu/dev/test/perf/data/collation",
|
||||
"outputDir"=>"svn-icu4j/results_ICU4J"
|
||||
};
|
||||
|
||||
# programs
|
||||
# Test class
|
||||
my $TESTCLASS = "com.ibm.icu.dev.test.perf.RBBIPerf";
|
||||
# tests will be done for all the programs. Results will be stored and connected
|
||||
my $m1 = "char";
|
||||
my $m2 = "word";
|
||||
my $m3 = "line";
|
||||
my $m4 = "jdkline";
|
||||
|
||||
my $m;
|
||||
|
||||
if(@_ >= 0) {
|
||||
$m = "-- -m ".shift;
|
||||
} else {
|
||||
$m = $m1;
|
||||
}
|
||||
|
||||
my $jvm1 = "java -classpath svn-icu4j_3-6/classes $TESTCLASS";
|
||||
my $jvm2 = "java -classpath svn-icu4j/classes $TESTCLASS";
|
||||
|
||||
my $dataFiles = {
|
||||
"en", [
|
||||
#"thesis.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_Latin.txt",
|
||||
"TestNames_SerbianSH.txt",
|
||||
"TestNames_SerbianSR.txt",
|
||||
"TestNames_Thai.txt",
|
||||
"Testnames_Russian.txt",
|
||||
],
|
||||
#"th", ["TestNames_Thai.txt", "th18057.txt"]
|
||||
};
|
||||
|
||||
|
||||
my $tests = {
|
||||
"TestNextChar", ["$jvm1 testRBBINext $m1", "$jvm2 testRBBINext $m1"],
|
||||
"TestNextWord", ["$jvm1 testRBBINext $m2", "$jvm2 testRBBINext $m2"],
|
||||
"TestNextLine", ["$jvm1 testRBBINext $m3", "$jvm2 testRBBINext $m3"],
|
||||
"TestNextJDKLine", ["$jvm1 testRBBINext $m4", "$jvm2 testRBBINext $m4"],
|
||||
##
|
||||
"TestPreviousChar", ["$jvm1 testRBBIPrevious $m1", "$jvm2 testRBBIPrevious $m1"],
|
||||
"TestPreviousWord", ["$jvm1 testRBBIPrevious $m2", "$jvm2 testRBBIPrevious $m2"],
|
||||
"TestPreviousLine", ["$jvm1 testRBBIPrevious $m3", "$jvm2 testRBBIPrevious $m3"],
|
||||
#"TestPreviousSentence", ["$jvm1 testRBBIPrevious $m4", "$jvm2 testRBBIPrevious $m4"],
|
||||
##
|
||||
"TestIsBoundaryChar", ["$jvm1 testRBBIIsBoundary $m1", "$jvm2 testRBBIIsBoundary $m1"],
|
||||
"TestIsBoundaryWord", ["$jvm1 testRBBIIsBoundary $m2", "$jvm2 testRBBIIsBoundary $m2"],
|
||||
"TestIsBoundaryLine", ["$jvm1 testRBBIIsBoundary $m3", "$jvm2 testRBBIIsBoundary $m3"],
|
||||
#"TestIsBoundarySentence", ["$jvm1 testRBBIIsBoundary $m4", "$jvm2 testRBBIIsBoundary $m4"],
|
||||
};
|
||||
|
||||
runTests($options, $tests, $dataFiles);
|
||||
|
||||
|
||||
|
|
122
src/com/ibm/icu/dev/test/perf/ucharacterperf_r.pl
Normal file → Executable file
122
src/com/ibm/icu/dev/test/perf/ucharacterperf_r.pl
Normal file → Executable file
|
@ -1,61 +1,61 @@
|
|||
#!/usr/bin/perl
|
||||
# ********************************************************************
|
||||
# * COPYRIGHT:
|
||||
# * Copyright (c) 2002-2007, International Business Machines
|
||||
# * Corporation and others. All Rights Reserved.
|
||||
# ********************************************************************
|
||||
|
||||
use strict;
|
||||
|
||||
#Assume we are running outside of the ICU4J source
|
||||
use lib 'svn-icu4j/src/com/ibm/icu/dev/test/perf/perldriver';
|
||||
|
||||
use PerfFramework4j;
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Test class
|
||||
my $TESTCLASS = 'com.ibm.icu.dev.test.perf.UCharacterPerf';
|
||||
|
||||
my $options = {
|
||||
"title"=>"UnicodeCharacter Property performance regression (ICU4J 3.6 and 3.8)",
|
||||
"headers"=>"ICU4J36 ICU4J38",
|
||||
"operationIs"=>"code point",
|
||||
"timePerOperationIs"=>"Time per code point",
|
||||
"passes"=>"10",
|
||||
"time"=>"5",
|
||||
"outputType"=>"HTML",
|
||||
"dataDir"=>"svn-icu4j/src/com/ibm/icu/dev/test/perf/data/collation",
|
||||
"outputDir"=>"svn-icu4j/results_ICU4J"
|
||||
};
|
||||
|
||||
# programs
|
||||
|
||||
my $jvm1 = "java -classpath svn-icu4j/classes $TESTCLASS";
|
||||
my $jvm2 = "java -classpath svn-icu4j_3-6/classes $TESTCLASS";
|
||||
|
||||
my $dataFiles = "";
|
||||
my $pat = '0 ffff';
|
||||
|
||||
my $tests = {
|
||||
"Digit ($pat)", ["$jvm1 Digit $pat" , "$jvm2 Digit $pat" ],
|
||||
"GetNumericValue ($pat)", ["$jvm1 GetNumericValue $pat" , "$jvm2 GetNumericValue $pat" ],
|
||||
"GetType ($pat)", ["$jvm1 GetType $pat" , "$jvm2 GetType $pat" ],
|
||||
"IsDefined ($pat)", ["$jvm1 IsDefined $pat" , "$jvm2 IsDefined $pat" ],
|
||||
"IsDigit ($pat)", ["$jvm1 IsDigit $pat" , "$jvm2 IsDigit $pat" ],
|
||||
"IsIdentifierIgnorable ($pat)", ["$jvm1 IsIdentifierIgnorable $pat" , "$jvm2 IsIdentifierIgnorable $pat" ],
|
||||
"IsISOControl ($pat)", ["$jvm1 IsISOControl $pat" , "$jvm2 IsISOControl $pat" ],
|
||||
"IsLetter ($pat)", ["$jvm1 IsLetter $pat" , "$jvm2 IsLetter $pat" ],
|
||||
"IsLetterOrDigit ($pat)", ["$jvm1 IsLetterOrDigit $pat" , "$jvm2 IsLetterOrDigit $pat" ],
|
||||
"IsLowerCase ($pat)", ["$jvm1 IsLowerCase $pat" , "$jvm2 IsLowerCase $pat" ],
|
||||
"IsSpaceChar ($pat)", ["$jvm1 IsSpaceChar $pat" , "$jvm2 IsSpaceChar $pat" ],
|
||||
"IsTitleCase ($pat)", ["$jvm1 IsTitleCase $pat" , "$jvm2 IsTitleCase $pat" ],
|
||||
"IsUnicodeIdentifierPart ($pat)", ["$jvm1 IsUnicodeIdentifierPart $pat" , "$jvm2 IsUnicodeIdentifierPart $pat" ],
|
||||
"IsUnicodeIdentifierStart ($pat)", ["$jvm1 IsUnicodeIdentifierStart $pat" , "$jvm2 IsUnicodeIdentifierStart $pat" ],
|
||||
"IsUpperCase ($pat)", ["$jvm1 IsUpperCase $pat" , "$jvm2 IsUpperCase $pat" ],
|
||||
"IsWhiteSpace ($pat)", ["$jvm1 IsWhiteSpace $pat" , "$jvm2 IsWhiteSpace $pat" ]
|
||||
};
|
||||
|
||||
|
||||
runTests($options, $tests, $dataFiles);
|
||||
|
||||
|
||||
#!/usr/bin/perl
|
||||
# ********************************************************************
|
||||
# * COPYRIGHT:
|
||||
# * Copyright (c) 2002-2007, International Business Machines
|
||||
# * Corporation and others. All Rights Reserved.
|
||||
# ********************************************************************
|
||||
|
||||
use strict;
|
||||
|
||||
#Assume we are running outside of the ICU4J source
|
||||
use lib 'svn-icu4j/src/com/ibm/icu/dev/test/perf/perldriver';
|
||||
|
||||
use PerfFramework4j;
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Test class
|
||||
my $TESTCLASS = 'com.ibm.icu.dev.test.perf.UCharacterPerf';
|
||||
|
||||
my $options = {
|
||||
"title"=>"UnicodeCharacter Property performance regression (ICU4J 3.6 and 3.8)",
|
||||
"headers"=>"ICU4J36 ICU4J38",
|
||||
"operationIs"=>"code point",
|
||||
"timePerOperationIs"=>"Time per code point",
|
||||
"passes"=>"10",
|
||||
"time"=>"5",
|
||||
"outputType"=>"HTML",
|
||||
"dataDir"=>"svn-icu4j/src/com/ibm/icu/dev/test/perf/data/collation",
|
||||
"outputDir"=>"svn-icu4j/results_ICU4J"
|
||||
};
|
||||
|
||||
# programs
|
||||
|
||||
my $jvm1 = "java -classpath svn-icu4j/classes $TESTCLASS";
|
||||
my $jvm2 = "java -classpath svn-icu4j_3-6/classes $TESTCLASS";
|
||||
|
||||
my $dataFiles = "";
|
||||
my $pat = '0 ffff';
|
||||
|
||||
my $tests = {
|
||||
"Digit ($pat)", ["$jvm1 Digit $pat" , "$jvm2 Digit $pat" ],
|
||||
"GetNumericValue ($pat)", ["$jvm1 GetNumericValue $pat" , "$jvm2 GetNumericValue $pat" ],
|
||||
"GetType ($pat)", ["$jvm1 GetType $pat" , "$jvm2 GetType $pat" ],
|
||||
"IsDefined ($pat)", ["$jvm1 IsDefined $pat" , "$jvm2 IsDefined $pat" ],
|
||||
"IsDigit ($pat)", ["$jvm1 IsDigit $pat" , "$jvm2 IsDigit $pat" ],
|
||||
"IsIdentifierIgnorable ($pat)", ["$jvm1 IsIdentifierIgnorable $pat" , "$jvm2 IsIdentifierIgnorable $pat" ],
|
||||
"IsISOControl ($pat)", ["$jvm1 IsISOControl $pat" , "$jvm2 IsISOControl $pat" ],
|
||||
"IsLetter ($pat)", ["$jvm1 IsLetter $pat" , "$jvm2 IsLetter $pat" ],
|
||||
"IsLetterOrDigit ($pat)", ["$jvm1 IsLetterOrDigit $pat" , "$jvm2 IsLetterOrDigit $pat" ],
|
||||
"IsLowerCase ($pat)", ["$jvm1 IsLowerCase $pat" , "$jvm2 IsLowerCase $pat" ],
|
||||
"IsSpaceChar ($pat)", ["$jvm1 IsSpaceChar $pat" , "$jvm2 IsSpaceChar $pat" ],
|
||||
"IsTitleCase ($pat)", ["$jvm1 IsTitleCase $pat" , "$jvm2 IsTitleCase $pat" ],
|
||||
"IsUnicodeIdentifierPart ($pat)", ["$jvm1 IsUnicodeIdentifierPart $pat" , "$jvm2 IsUnicodeIdentifierPart $pat" ],
|
||||
"IsUnicodeIdentifierStart ($pat)", ["$jvm1 IsUnicodeIdentifierStart $pat" , "$jvm2 IsUnicodeIdentifierStart $pat" ],
|
||||
"IsUpperCase ($pat)", ["$jvm1 IsUpperCase $pat" , "$jvm2 IsUpperCase $pat" ],
|
||||
"IsWhiteSpace ($pat)", ["$jvm1 IsWhiteSpace $pat" , "$jvm2 IsWhiteSpace $pat" ]
|
||||
};
|
||||
|
||||
|
||||
runTests($options, $tests, $dataFiles);
|
||||
|
||||
|
||||
|
|
118
src/com/ibm/icu/dev/test/perf/unicodesetperf_r.pl
Normal file → Executable file
118
src/com/ibm/icu/dev/test/perf/unicodesetperf_r.pl
Normal file → Executable file
|
@ -1,59 +1,59 @@
|
|||
#!/usr/bin/perl
|
||||
# ********************************************************************
|
||||
# * COPYRIGHT:
|
||||
# * Copyright (c) 2002-2007, International Business Machines
|
||||
# * Corporation and others. All Rights Reserved.
|
||||
# ********************************************************************
|
||||
|
||||
use strict;
|
||||
|
||||
#Assume we are running outside of the ICU4J source
|
||||
use lib 'svn-icu4j/src/com/ibm/icu/dev/test/perf/perldriver';
|
||||
|
||||
use PerfFramework4j;
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Test class
|
||||
my $TESTCLASS = 'com.ibm.icu.dev.test.perf.UnicodeSetPerf';
|
||||
|
||||
my $options = {
|
||||
"title"=>"Unicode Set performance regression (ICU4J 3.6 and 3.8)",
|
||||
"headers"=>"ICU4J36 ICU4J38",
|
||||
"operationIs"=>"code point",
|
||||
"timePerOperationIs"=>"Time per code point",
|
||||
"passes"=>"10",
|
||||
"time"=>"5",
|
||||
"outputType"=>"HTML",
|
||||
"dataDir"=>"svn-icu4j/src/com/ibm/icu/dev/test/perf/data/collation",
|
||||
"outputDir"=>"svn-icu4j/results_ICU4J"
|
||||
};
|
||||
|
||||
# programs
|
||||
|
||||
my $jvm1 = "java -classpath svn-icu4j_3-6/classes $TESTCLASS";
|
||||
my $jvm2 = "java -classpath svn-icu4j/classes $TESTCLASS";
|
||||
|
||||
my $dataFiles = "";
|
||||
my $pat1 = '[:Lt:]';
|
||||
my $pat2 = '[:Cn:]';
|
||||
|
||||
my $tests = {
|
||||
"UnicodeSetAdd ($pat1)", ["$jvm1 UnicodeSetAdd $pat1" , "$jvm2 UnicodeSetAdd $pat1" ],
|
||||
"UnicodeSetAdd ($pat2)", ["$jvm1 UnicodeSetAdd $pat2" , "$jvm2 UnicodeSetAdd $pat2" ],
|
||||
"UnicodeSetContains ($pat1)", ["$jvm1 UnicodeSetContains $pat1" , "$jvm2 UnicodeSetContains $pat1" ],
|
||||
"UnicodeSetContains ($pat2)", ["$jvm1 UnicodeSetContains $pat2" , "$jvm2 UnicodeSetContains $pat2" ],
|
||||
"UnicodeSetIterate ($pat1)", ["$jvm1 UnicodeSetIterate $pat1" , "$jvm2 UnicodeSetIterate $pat1" ],
|
||||
"UnicodeSetIterate ($pat2)", ["$jvm1 UnicodeSetIterate $pat2" , "$jvm2 UnicodeSetIterate $pat2" ],
|
||||
##
|
||||
"HashSetAdd ($pat1)", ["$jvm1 HashSetAdd $pat1" , "$jvm2 HashSetAdd $pat1" ],
|
||||
"HashSetAdd ($pat2)", ["$jvm1 HashSetAdd $pat2" , "$jvm2 HashSetAdd $pat2" ],
|
||||
"HashSetContains ($pat1)", ["$jvm1 HashSetContains $pat1" , "$jvm2 HashSetContains $pat1" ],
|
||||
"HashSetContains ($pat2)", ["$jvm1 HashSetContains $pat2" , "$jvm2 HashSetContains $pat2" ],
|
||||
"HashSetIterate ($pat1)", ["$jvm1 HashSetIterate $pat1" , "$jvm2 HashSetIterate $pat1" ],
|
||||
"HashSetIterate ($pat2)", ["$jvm1 HashSetIterate $pat2" , "$jvm2 HashSetIterate $pat2" ]
|
||||
};
|
||||
|
||||
|
||||
runTests($options, $tests, $dataFiles);
|
||||
|
||||
|
||||
#!/usr/bin/perl
|
||||
# ********************************************************************
|
||||
# * COPYRIGHT:
|
||||
# * Copyright (c) 2002-2007, International Business Machines
|
||||
# * Corporation and others. All Rights Reserved.
|
||||
# ********************************************************************
|
||||
|
||||
use strict;
|
||||
|
||||
#Assume we are running outside of the ICU4J source
|
||||
use lib 'svn-icu4j/src/com/ibm/icu/dev/test/perf/perldriver';
|
||||
|
||||
use PerfFramework4j;
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Test class
|
||||
my $TESTCLASS = 'com.ibm.icu.dev.test.perf.UnicodeSetPerf';
|
||||
|
||||
my $options = {
|
||||
"title"=>"Unicode Set performance regression (ICU4J 3.6 and 3.8)",
|
||||
"headers"=>"ICU4J36 ICU4J38",
|
||||
"operationIs"=>"code point",
|
||||
"timePerOperationIs"=>"Time per code point",
|
||||
"passes"=>"10",
|
||||
"time"=>"5",
|
||||
"outputType"=>"HTML",
|
||||
"dataDir"=>"svn-icu4j/src/com/ibm/icu/dev/test/perf/data/collation",
|
||||
"outputDir"=>"svn-icu4j/results_ICU4J"
|
||||
};
|
||||
|
||||
# programs
|
||||
|
||||
my $jvm1 = "java -classpath svn-icu4j_3-6/classes $TESTCLASS";
|
||||
my $jvm2 = "java -classpath svn-icu4j/classes $TESTCLASS";
|
||||
|
||||
my $dataFiles = "";
|
||||
my $pat1 = '[:Lt:]';
|
||||
my $pat2 = '[:Cn:]';
|
||||
|
||||
my $tests = {
|
||||
"UnicodeSetAdd ($pat1)", ["$jvm1 UnicodeSetAdd $pat1" , "$jvm2 UnicodeSetAdd $pat1" ],
|
||||
"UnicodeSetAdd ($pat2)", ["$jvm1 UnicodeSetAdd $pat2" , "$jvm2 UnicodeSetAdd $pat2" ],
|
||||
"UnicodeSetContains ($pat1)", ["$jvm1 UnicodeSetContains $pat1" , "$jvm2 UnicodeSetContains $pat1" ],
|
||||
"UnicodeSetContains ($pat2)", ["$jvm1 UnicodeSetContains $pat2" , "$jvm2 UnicodeSetContains $pat2" ],
|
||||
"UnicodeSetIterate ($pat1)", ["$jvm1 UnicodeSetIterate $pat1" , "$jvm2 UnicodeSetIterate $pat1" ],
|
||||
"UnicodeSetIterate ($pat2)", ["$jvm1 UnicodeSetIterate $pat2" , "$jvm2 UnicodeSetIterate $pat2" ],
|
||||
##
|
||||
"HashSetAdd ($pat1)", ["$jvm1 HashSetAdd $pat1" , "$jvm2 HashSetAdd $pat1" ],
|
||||
"HashSetAdd ($pat2)", ["$jvm1 HashSetAdd $pat2" , "$jvm2 HashSetAdd $pat2" ],
|
||||
"HashSetContains ($pat1)", ["$jvm1 HashSetContains $pat1" , "$jvm2 HashSetContains $pat1" ],
|
||||
"HashSetContains ($pat2)", ["$jvm1 HashSetContains $pat2" , "$jvm2 HashSetContains $pat2" ],
|
||||
"HashSetIterate ($pat1)", ["$jvm1 HashSetIterate $pat1" , "$jvm2 HashSetIterate $pat1" ],
|
||||
"HashSetIterate ($pat2)", ["$jvm1 HashSetIterate $pat2" , "$jvm2 HashSetIterate $pat2" ]
|
||||
};
|
||||
|
||||
|
||||
runTests($options, $tests, $dataFiles);
|
||||
|
||||
|
||||
|
|
0
src/com/ibm/icu/dev/test/rbbi/BreakIteratorRules_en_US_TEST.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/rbbi/BreakIteratorRules_en_US_TEST.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/rbbi/BreakIteratorTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/rbbi/BreakIteratorTest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/rbbi/RBBIAPITest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/rbbi/RBBIAPITest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/rbbi/RBBITest.java
Executable file → Normal file
0
src/com/ibm/icu/dev/test/rbbi/RBBITest.java
Executable file → Normal file
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue