use of com.google.caliper.BeforeExperiment in project android_frameworks_base by DirtyUnicorns.
the class LinkifyBenchmark method setUp.
@BeforeExperiment
protected void setUp() throws Exception {
int copyAmount = Integer.parseInt(mParamCopyAmount);
StringBuilder strBuilder = new StringBuilder();
for (int i = 0; i < copyAmount; i++) {
strBuilder.append(mParamBasicText);
}
mTestSpannable = new SpannableString(strBuilder.toString());
}
use of com.google.caliper.BeforeExperiment in project android_frameworks_base by crdroidandroid.
the class LinkifyBenchmark method setUp.
@BeforeExperiment
protected void setUp() throws Exception {
int copyAmount = Integer.parseInt(mParamCopyAmount);
StringBuilder strBuilder = new StringBuilder();
for (int i = 0; i < copyAmount; i++) {
strBuilder.append(mParamBasicText);
}
mTestSpannable = new SpannableString(strBuilder.toString());
}
use of com.google.caliper.BeforeExperiment in project android_frameworks_base by crdroidandroid.
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);
}
use of com.google.caliper.BeforeExperiment in project guava by google.
the class FuturesGetCheckedBenchmark method addOtherEntries.
@BeforeExperiment
void addOtherEntries() throws Exception {
GetCheckedTypeValidator validator = this.validator.validator;
Class<? extends Exception> exceptionType = this.exceptionType.exceptionType;
for (Class<? extends Exception> exceptionClass : OTHER_EXCEPTION_TYPES.asList().subList(0, otherEntriesInDataStructure)) {
getChecked(validator, immediateFuture(""), exceptionClass);
}
for (int i = 0; i < otherEntriesInDataStructure; i++) {
ClassValue<Boolean> classValue = new ClassValue<Boolean>() {
@Override
protected Boolean computeValue(Class<?> type) {
return true;
}
};
classValue.get(exceptionType);
retainedReferencesToOtherClassValues.add(classValue);
}
}
use of com.google.caliper.BeforeExperiment in project guava by google.
the class AsciiBenchmark method setUp.
@BeforeExperiment
void setUp() {
// fix the seed so results are comparable across runs
random = new Random(0xdeadbeef);
int nonAlpha = size / nonAlphaRatio;
int alpha = size - nonAlpha;
List<Character> chars = Lists.newArrayListWithCapacity(size);
for (int i = 0; i < alpha; i++) {
chars.add(randomAlpha());
}
for (int i = 0; i < nonAlpha; i++) {
chars.add(randomNonAlpha());
}
Collections.shuffle(chars, random);
char[] array = Chars.toArray(chars);
this.testString = new String(array);
}
Aggregations