1 |
|
/* |
2 |
|
* Written by Doug Lea with assistance from members of JCP JSR-166 |
3 |
|
* Expert Group and released to the public domain, as explained at |
4 |
< |
* http://creativecommons.org/licenses/publicdomain |
4 |
> |
* http://creativecommons.org/publicdomain/zero/1.0/ |
5 |
|
*/ |
6 |
|
|
7 |
|
import java.util.*; |
102 |
|
jobs[2] = new Job("Integer ", is, Integer.class); |
103 |
|
|
104 |
|
Object[] ls = new Object[n]; |
105 |
< |
for (int i = 0; i < n; i++) ls[i] = Long.valueOf((long)i); |
105 |
> |
for (int i = 0; i < n; i++) ls[i] = Long.valueOf((long) i); |
106 |
|
jobs[3] = new Job("Long ", ls, Long.class); |
107 |
|
|
108 |
|
Object[] fs = new Object[n]; |
109 |
< |
for (int i = 0; i < n; i++) fs[i] = Float.valueOf((float)i); |
109 |
> |
for (int i = 0; i < n; i++) fs[i] = Float.valueOf((float) i); |
110 |
|
jobs[4] = new Job("Float ", fs, Float.class); |
111 |
|
|
112 |
|
Object[] ds = new Object[n]; |
113 |
< |
for (int i = 0; i < n; i++) ds[i] = Double.valueOf((double)i); |
113 |
> |
for (int i = 0; i < n; i++) ds[i] = Double.valueOf((double) i); |
114 |
|
jobs[5] = new Job("Double ", ds, Double.class); |
115 |
|
|
116 |
|
Object[] bs = new Object[n]; |
143 |
|
warmup1(mixed); |
144 |
|
warmup3(jobs); |
145 |
|
Thread.sleep(500); |
146 |
< |
time(jobs); |
146 |
> |
time(jobs); |
147 |
|
} |
148 |
|
|
149 |
|
static void runWork(Job[] jobs, int minIters, int maxIters, long timeLimit) throws Throwable { |
193 |
|
long[] aves = new long[nsizes]; |
194 |
|
int njobs = jobs.length; |
195 |
|
|
196 |
< |
for (int i = 0; i < njobs; i++) { |
196 |
> |
for (int i = 0; i < njobs; i++) { |
197 |
|
System.out.print(jobs[i].name); |
198 |
|
for (int k = 0; k < nsizes; ++k) { |
199 |
|
long nanos = jobs[i].nanos[k]; |
212 |
|
|
213 |
|
|
214 |
|
static final class Job { |
215 |
< |
final String name; |
215 |
> |
final String name; |
216 |
|
final Class elementClass; |
217 |
|
long[] nanos = new long[nsizes]; |
218 |
|
final Object[] items; |
334 |
|
if (m.put(x, x) == null) |
335 |
|
++sum; |
336 |
|
} |
337 |
+ |
/* // uncomment to avoid calling clear() |
338 |
+ |
for (int i = 0; i < len; ++i) { |
339 |
+ |
Object x = keys[i]; |
340 |
+ |
m.remove(x); |
341 |
+ |
} |
342 |
+ |
*/ |
343 |
|
m.clear(); |
344 |
|
sum += len - (quarter * 2); |
345 |
|
checkSum += sum ^ (sum << 12); |
356 |
|
if (minIters != 1 && randomSearches) |
357 |
|
shuffleSome(ins, len, len >>> 3); |
358 |
|
} |
359 |
< |
long ops = ((long)j) * len * OPS_PER_ITER; |
359 |
> |
long ops = ((long) j) * len * OPS_PER_ITER; |
360 |
|
lastSum = sum; |
361 |
|
return elapsed / ops; |
362 |
|
} |
450 |
|
int c = in.read(); |
451 |
|
if (c < 0) |
452 |
|
break outer; |
453 |
< |
char ch = (char)c; |
453 |
> |
char ch = (char) c; |
454 |
|
if (ch == '\n') { |
455 |
|
keys[k++] = sb.toString(); |
456 |
|
break; |