author | jiangli |
Wed, 27 Sep 2017 17:55:20 -0400 | |
changeset 47548 | 664b9d44db74 |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
13257
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
1 |
/* |
14342
8435a30053c1
7197491: update copyright year to match last edit in jdk8 jdk repository
alanb
parents:
13257
diff
changeset
|
2 |
* Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. |
13257
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
4 |
* |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
8 |
* |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
13 |
* accompanied this code). |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
14 |
* |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
18 |
* |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
21 |
* questions. |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
22 |
*/ |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
23 |
|
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
24 |
import java.util.*; |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
25 |
import java.nio.*; |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
26 |
import java.nio.charset.*; |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
27 |
import java.util.concurrent.*; |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
28 |
import java.util.regex.Pattern; |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
29 |
|
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
30 |
public class StrCodingBenchmarkDB extends StrCodingBenchmark { |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
31 |
|
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
32 |
|
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
33 |
public static void main(String[] args) throws Throwable { |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
34 |
final int itrs = Integer.getInteger("iterations", 100000); |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
35 |
//final int itrs = Integer.getInteger("iterations", 12); |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
36 |
final int size = Integer.getInteger("size", 2048); |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
37 |
final int subsize = Integer.getInteger("subsize", 128); |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
38 |
final int maxchar = Integer.getInteger("maxchar", 128); |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
39 |
final String regex = System.getProperty("filter"); |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
40 |
final Pattern filter = (regex == null) ? null : Pattern.compile(regex); |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
41 |
final boolean useSecurityManager = Boolean.getBoolean("SecurityManager"); |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
42 |
if (useSecurityManager) |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
43 |
System.setSecurityManager(new PermissiveSecurityManger()); |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
44 |
final Random rnd = new Random(); |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
45 |
|
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
46 |
String[] csns = new String[] { |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
47 |
"Big5", |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
48 |
"Johab", |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
49 |
"EUC_CN", |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
50 |
"EUC_KR", |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
51 |
"MS932", |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
52 |
"MS936", |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
53 |
"MS949", |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
54 |
"MS950", |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
55 |
"GBK", |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
56 |
|
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
57 |
"Big5_HKSCS", |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
58 |
"Big5_HKSCS_2001", |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
59 |
"Big5_Solaris", |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
60 |
"MS950_HKSCS", |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
61 |
"MS950_HKSCS_XP", |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
62 |
"IBM1364", |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
63 |
"IBM1381", |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
64 |
"IBM1383", |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
65 |
"IBM930", |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
66 |
"IBM933", |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
67 |
"IBM935", |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
68 |
"IBM937", |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
69 |
"IBM939", |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
70 |
"IBM942", |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
71 |
"IBM943", |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
72 |
"IBM948", |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
73 |
"IBM949", |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
74 |
"IBM950", |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
75 |
"IBM970", |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
76 |
}; |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
77 |
|
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
78 |
ArrayList<long[]> sum = new ArrayList<>(); |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
79 |
|
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
80 |
for (final String csn : csns) { |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
81 |
final Charset cs = Charset.forName(csn); |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
82 |
List<Integer> cps = new ArrayList<>(0x4000); |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
83 |
int off = 0; |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
84 |
int cp = 0; |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
85 |
int n = 0; |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
86 |
CharsetEncoder enc = cs.newEncoder(); |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
87 |
while (cp < 0x10000 && n < cps.size()) { |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
88 |
if (enc.canEncode((char)cp)) { |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
89 |
cps.add(cp); |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
90 |
n++; |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
91 |
} |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
92 |
cp++; |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
93 |
} |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
94 |
Collections.shuffle(cps); |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
95 |
char[] ca = new char[cps.size()]; |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
96 |
for (int i = 0; i < cps.size(); i++) |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
97 |
ca[i] = (char)(int)cps.get(i); |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
98 |
|
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
99 |
|
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
100 |
System.out.printf("%n--------%s---------%n", csn); |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
101 |
for (int sz = 8; sz <= 2048; sz *= 2) { |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
102 |
System.out.printf(" [len=%d]%n", sz); |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
103 |
|
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
104 |
final char[] chars = Arrays.copyOf(ca, sz); |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
105 |
final String str = new String(chars); |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
106 |
final byte[] bs = str.getBytes(cs); |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
107 |
|
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
108 |
Job[] jobs = { |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
109 |
|
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
110 |
new Job("String decode: csn") { |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
111 |
public void work() throws Throwable { |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
112 |
for (int i = 0; i < itrs; i++) |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
113 |
new String(bs, csn); |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
114 |
}}, |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
115 |
|
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
116 |
new Job("String decode: cs") { |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
117 |
public void work() throws Throwable { |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
118 |
for (int i = 0; i < itrs; i++) |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
119 |
new String(bs, cs); |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
120 |
}}, |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
121 |
|
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
122 |
new Job("String encode: csn") { |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
123 |
public void work() throws Throwable { |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
124 |
for (int i = 0; i < itrs; i++) |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
125 |
str.getBytes(csn); |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
126 |
}}, |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
127 |
|
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
128 |
new Job("String encode: cs") { |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
129 |
public void work() throws Throwable { |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
130 |
for (int i = 0; i < itrs; i++) |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
131 |
str.getBytes(cs); |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
132 |
}}, |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
133 |
}; |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
134 |
sum.add(time(jobs)); |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
135 |
|
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
136 |
} |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
137 |
} |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
138 |
} |
5cf4ff2cbb37
7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents:
diff
changeset
|
139 |
} |