本文整理汇总了Java中dk.ilios.spanner.Benchmark类的典型用法代码示例。如果您正苦于以下问题:Java Benchmark类的具体用法?Java Benchmark怎么用?Java Benchmark使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Benchmark类属于dk.ilios.spanner包,在下文中一共展示了Benchmark类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: coldCreateAndClose
import dk.ilios.spanner.Benchmark; //导入依赖的package包/类
@Benchmark
public void coldCreateAndClose(long reps) {
for (long i = 0; i < reps; i++) {
Realm realm = Realm.getInstance(coldConfig);
realm.close();
}
}
示例2: emptyTransaction
import dk.ilios.spanner.Benchmark; //导入依赖的package包/类
@Benchmark
public void emptyTransaction(long reps) {
for (long i = 0; i < reps; i++) {
realm.beginTransaction();
realm.commitTransaction();
}
}
示例3: createObjects
import dk.ilios.spanner.Benchmark; //导入依赖的package包/类
@Benchmark
public void createObjects(long reps) {
RealmResults<AllTypes> results = realm.where(AllTypes.class).findAll();
for (long i = 0; i < reps; i++) {
results.first();
}
}
示例4: createRealmResults
import dk.ilios.spanner.Benchmark; //导入依赖的package包/类
@Benchmark
public void createRealmResults(long reps) {
RealmQuery<AllTypes> query = realm.where(AllTypes.class);
for (long i = 0; i < reps; i++) {
query.findAll();
}
}
示例5: createRealmLists
import dk.ilios.spanner.Benchmark; //导入依赖的package包/类
@Benchmark
public void createRealmLists(long reps) {
AllTypes allTypes = realm.where(AllTypes.class).findFirst();
for (long i = 0; i < reps; i++) {
//noinspection ConstantConditions
allTypes.getColumnRealmList();
}
}
示例6: insertNoPrimaryKey
import dk.ilios.spanner.Benchmark; //导入依赖的package包/类
@Benchmark
public void insertNoPrimaryKey(long reps) {
AllTypes allTypes = new AllTypes();
for (long i = 0; i < reps; i++) {
realm.insert(allTypes);
}
}
示例7: insertWithPrimaryKey
import dk.ilios.spanner.Benchmark; //导入依赖的package包/类
@Benchmark
public void insertWithPrimaryKey(long reps) {
AllTypesPrimaryKey allTypesPrimaryKey = new AllTypesPrimaryKey();
for (long i = 0; i < reps; i++) {
allTypesPrimaryKey.setColumnLong(i);
realm.insertOrUpdate(allTypesPrimaryKey);
}
}
示例8: combineHashCodes
import dk.ilios.spanner.Benchmark; //导入依赖的package包/类
@Benchmark
public int combineHashCodes() {
int dummy = 0;
int combined = 0;
for (Object item : items) {
combined ^= item.hashCode();
}
dummy += combined;
return dummy;
}
示例9: getFromSmallHashSet
import dk.ilios.spanner.Benchmark; //导入依赖的package包/类
@Benchmark
public boolean getFromSmallHashSet() {
HashSet<Object> set = new HashSet<>();
// add few items to prevent check for empty map
set.add(new Object());
set.add(4);
set.add("tralalal");
boolean dummy = true;
for (Object item: items) {
dummy &= set.contains(item);
}
return dummy;
}
示例10: putInHashSet
import dk.ilios.spanner.Benchmark; //导入依赖的package包/类
@Benchmark
public int putInHashSet() {
HashSet<Object> set = new HashSet<>(items);
int dummy = set.size();
return dummy;
}
示例11: putInHashSetAndGetOnce
import dk.ilios.spanner.Benchmark; //导入依赖的package包/类
@Benchmark
public boolean putInHashSetAndGetOnce() {
HashSet<Object> set = new HashSet<>(items);
boolean dummy = true;
for (Object item: items) {
dummy &= set.contains(item);
}
return dummy;
}
示例12: putInHashSetAndGetTenTimes
import dk.ilios.spanner.Benchmark; //导入依赖的package包/类
@Benchmark
public boolean putInHashSetAndGetTenTimes() {
HashSet<Object> set = new HashSet<>(items);
boolean dummy = true;
for (int q = 0; q < 10; q++) {
for (Object item : items) {
dummy &= set.contains(item);
}
}
return dummy;
}
示例13: write500ContactsBinary
import dk.ilios.spanner.Benchmark; //导入依赖的package包/类
@Benchmark
public void write500ContactsBinary() throws IOException {
//Buffer buffer = new Buffer();
buffer.writeInt(contacts.size());
for (Person contact : contacts) {
contact.writeObject(buffer);
}
}
示例14: writeShortString
import dk.ilios.spanner.Benchmark; //导入依赖的package包/类
@Benchmark
public void writeShortString(long reps) {
for (long i = 0; i < reps; i++) {
writeObject.setColumnString("Foo");
}
}
示例15: writeMediumString
import dk.ilios.spanner.Benchmark; //导入依赖的package包/类
@Benchmark
public void writeMediumString(long reps) {
for (long i = 0; i < reps; i++) {
writeObject.setColumnString("ABCDEFHIJKLMNOPQ");
}
}