use of com.cinchapi.common.profile.Benchmark in project concourse by cinchapi.
the class CrossVersionSelectAllVsSelectKeysBenchmarkTest method testSelectAll.
@Test
public void testSelectAll() {
Benchmark benchmark = new Benchmark(TimeUnit.MILLISECONDS) {
@Override
public void action() {
client.select(records);
}
};
long elapsed = benchmark.run();
record("select all", elapsed);
}
use of com.cinchapi.common.profile.Benchmark in project concourse by cinchapi.
the class CrossVersionWriteBenchmarkTest method testWrite.
@Test
public void testWrite() {
Benchmark benchmark = new Benchmark(TimeUnit.MILLISECONDS) {
@Override
public void action() {
for (int i = 0; i < 10000; ++i) {
client.add("foo", Time.now(), i);
}
}
};
double avg = benchmark.run(10) / 10;
record("write", avg);
}
use of com.cinchapi.common.profile.Benchmark in project concourse by cinchapi.
the class CrossVersionReadBenchmarkTest method testRead.
@Test
public void testRead() {
Benchmark benchmark = new Benchmark(TimeUnit.MILLISECONDS) {
@Override
public void action() {
client.select("foo < " + Time.now());
}
};
double avg = benchmark.run(10) / 10;
record("read", avg);
}
use of com.cinchapi.common.profile.Benchmark in project concourse by cinchapi.
the class DatabaseTest method testGatherVsSelectBenchmark.
@Test
public void testGatherVsSelectBenchmark() {
java.util.Random rand = new java.util.Random();
Database store = (Database) this.store;
List<Long> records = Lists.newArrayList();
for (int i = 0; i < TestData.getScaleCount() * 100; ++i) {
records.add(Time.now());
}
List<String> keys = Lists.newArrayList();
for (int i = 0; i < TestData.getScaleCount() * 10; ++i) {
keys.add(Random.getSimpleString());
}
for (int i = 0; i < TestData.getScaleCount(); ++i) {
String key = keys.get(rand.nextInt(keys.size()));
long record = records.get(rand.nextInt(records.size()));
TObject value = Convert.javaToThrift(Random.getObject());
add(key, value, record);
if (rand.nextInt() % 6 == 0) {
remove(key, value, record);
}
}
Database $store = store;
Benchmark select = new Benchmark(TimeUnit.MILLISECONDS) {
@Override
public void action() {
for (long record : records) {
for (String key : keys) {
$store.select(key, record);
}
}
}
};
Benchmark gather = new Benchmark(TimeUnit.MILLISECONDS) {
@Override
public void action() {
for (long record : records) {
for (String key : keys) {
$store.gather(key, record);
}
}
}
};
double selectTime = select.run(1);
double gatherTime = gather.run(1);
System.out.println("Select took " + selectTime + " ms and gather took " + gatherTime + " ms");
Assert.assertTrue(gatherTime <= selectTime);
}
use of com.cinchapi.common.profile.Benchmark in project concourse by cinchapi.
the class StoresTest method testBenchmarkSelectKeyRecordsOptionalAtomicWithNavigation.
@Test
public void testBenchmarkSelectKeyRecordsOptionalAtomicWithNavigation() {
AtomicSupport store = getStore();
setupNavigationGraph(store);
// @formatter:off
List<String> keys = ImmutableList.of("job.title");
// @formatter:on
Benchmark serial = new Benchmark(TimeUnit.MICROSECONDS) {
@Override
public void action() {
Stores.serialSelect(store, keys.get(0), 1);
}
};
Benchmark bulk = new Benchmark(TimeUnit.MICROSECONDS) {
@Override
public void action() {
Stores.select(store, keys, 1);
}
};
double serialTime = serial.average(5);
double bulkTime = bulk.average(5);
System.out.println("single navigation serial = " + serialTime);
System.out.println("single navigation BULK = " + bulkTime);
}
Aggregations