use of com.cinchapi.common.profile.Benchmark in project concourse by cinchapi.
the class CrossVersionVerifyBenchmarkTest method testVerify.
@Test
public void testVerify() {
Benchmark benchmark = new Benchmark(TimeUnit.MILLISECONDS) {
@Override
public void action() {
for (int i = 0; i < 10000; ++i) {
// Verify known hits
client.verify("baz", "hello", i + 1);
client.verify("bang", tag, i + 1);
// Verify known miss
client.verify("foo", Time.now(), i + 1);
}
}
};
double avg = benchmark.average(10);
record("verify", avg);
}
use of com.cinchapi.common.profile.Benchmark in project concourse by cinchapi.
the class PaginationPerformanceTest method testPaginationDoesNotLoadEntireResultSet.
@Test
public void testPaginationDoesNotLoadEntireResultSet() {
Importer importer = new CsvImporter(client);
Set<Long> records = importer.importFile(Resources.get("/generated.csv").getFile());
server.stop();
server.start();
client = server.connect();
Benchmark all = new Benchmark(TimeUnit.MILLISECONDS) {
@Override
public void action() {
client.select(records);
}
};
long allTime = all.run();
server.stop();
server.start();
client = server.connect();
Benchmark paginated = new Benchmark(TimeUnit.MILLISECONDS) {
@Override
public void action() {
client.select(records, Page.sized(100).go(90));
}
};
long paginatedTime = paginated.run();
System.out.println(allTime);
System.out.println(paginatedTime);
Assert.assertTrue(paginatedTime < allTime);
}
use of com.cinchapi.common.profile.Benchmark in project accent4j by cinchapi.
the class StringSplitterPerformanceTest method testQuoteAwareSplit.
@Test
public void testQuoteAwareSplit() {
String string = "The Gangs All Here,www.youtube.com/embed/VlWsLs8G7Kg,," + "\"Anacostia follows the lives of the residents of ANACOSTIA, " + "a small residential community in Washington D.C. as they " + "navigate through love, betrayal, deception, sex and murder\"," + "ANACOSTIA,3,7,,Webseries,,,";
int rounds = 5000;
Benchmark builtIn = new Benchmark(TimeUnit.MICROSECONDS) {
@Override
public void action() {
AnyStrings.splitStringByDelimiterButRespectQuotes(string, ",");
}
};
Benchmark splitter = new Benchmark(TimeUnit.MICROSECONDS) {
@Override
public void action() {
new QuoteAwareStringSplitter(string, ',').toArray();
}
};
double builtInTime = builtIn.average(rounds);
double splitterTime = splitter.average(rounds);
System.out.println("Built-In: " + builtInTime);
System.out.println("Splitter: " + splitterTime);
Assert.assertTrue(splitterTime < builtInTime);
}
Aggregations