use of com.google.caliper.BeforeExperiment in project guava by google.
the class MessageDigestAlgorithmBenchmark method setUp.
@BeforeExperiment
void setUp() {
testBytes = new byte[size];
new Random(RANDOM_SEED).nextBytes(testBytes);
}
use of com.google.caliper.BeforeExperiment in project guava by google.
the class UnsignedBytesBenchmark method setUp.
@BeforeExperiment
void setUp() throws Exception {
Random r = new Random();
ba1 = new byte[length];
r.nextBytes(ba1);
ba2 = Arrays.copyOf(ba1, ba1.length);
// Differ at the last element
ba3 = Arrays.copyOf(ba1, ba1.length);
ba4 = Arrays.copyOf(ba1, ba1.length);
ba3[ba1.length - 1] = (byte) 43;
ba4[ba1.length - 1] = (byte) 42;
javaImpl = UnsignedBytes.lexicographicalComparatorJavaImpl();
unsafeImpl = UnsignedBytes.LexicographicalComparatorHolder.UnsafeComparator.INSTANCE;
}
use of com.google.caliper.BeforeExperiment in project guava by google.
the class CharMatcherBenchmark method setUp.
// Caliper invokes setUp() after injecting params
@BeforeExperiment
void setUp() {
this.matcher = precomputed ? config.matcher.precomputed() : config.matcher;
if (size == Size.SMALL) {
BitSet tmp = new BitSet();
matcher.setBits(tmp);
int matchedCharCount = tmp.cardinality();
this.matcher = SmallCharMatcher.from(tmp, "");
}
this.string = checkString(length, percent, config.matchingChars, new Random(), forceSlow, web);
}
use of com.google.caliper.BeforeExperiment in project guava by google.
the class HashMultisetAddPresentBenchmark method setUp.
@BeforeExperiment
void setUp() {
Random random = new Random();
multisets.clear();
for (int i = 0; i < ARRAY_SIZE; i++) {
HashMultiset<Integer> multiset = HashMultiset.<Integer>create();
multisets.add(multiset);
queries[i] = random.nextInt();
multiset.add(queries[i]);
}
}
use of com.google.caliper.BeforeExperiment in project android_frameworks_base by DirtyUnicorns.
the class IndentingPrintWriterBenchmark method setUp.
@BeforeExperiment
protected void setUp() throws IOException {
final FileOutputStream os = new FileOutputStream(new File("/dev/null"));
mDirect = new PrintWriter(os);
mIndenting = new IndentingPrintWriter(mDirect, " ");
final Node manyChildren = Node.build("ManyChildren", Node.build("1"), Node.build("2"), Node.build("3"), Node.build("4"), Node.build("5"), Node.build("6"), Node.build("7"), Node.build("8"), Node.build("9"), Node.build("10"));
mSimple = Node.build("RED");
mComplex = Node.build("PARENT", Node.build("RED"), Node.build("GREEN", Node.build("BLUE", manyChildren, manyChildren), manyChildren, manyChildren), manyChildren);
}
Aggregations