Search in sources :

Example 21 with Benchmark

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);
}
Also used : Benchmark(com.cinchapi.common.profile.Benchmark) Test(org.junit.Test)

Example 22 with Benchmark

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);
}
Also used : Benchmark(com.cinchapi.common.profile.Benchmark) CsvImporter(com.cinchapi.concourse.importer.CsvImporter) CsvImporter(com.cinchapi.concourse.importer.CsvImporter) Importer(com.cinchapi.concourse.importer.Importer) Test(org.junit.Test) ClientServerTest(com.cinchapi.concourse.test.ClientServerTest)

Example 23 with Benchmark

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);
}
Also used : Benchmark(com.cinchapi.common.profile.Benchmark) Test(org.junit.Test)

Aggregations

Benchmark (com.cinchapi.common.profile.Benchmark)23 Test (org.junit.Test)23 AtomicSupport (com.cinchapi.concourse.server.storage.AtomicSupport)4 TObject (com.cinchapi.concourse.thrift.TObject)2 CountUpLatch (com.cinchapi.common.concurrent.CountUpLatch)1 CsvImporter (com.cinchapi.concourse.importer.CsvImporter)1 Importer (com.cinchapi.concourse.importer.Importer)1 Value (com.cinchapi.concourse.server.model.Value)1 LazyTrackingTObjectResultDataset (com.cinchapi.concourse.server.plugin.data.LazyTrackingTObjectResultDataset)1 StoreTest (com.cinchapi.concourse.server.storage.StoreTest)1 ClientServerTest (com.cinchapi.concourse.test.ClientServerTest)1 ConcourseBaseTest (com.cinchapi.concourse.test.ConcourseBaseTest)1 Random (com.cinchapi.concourse.util.Random)1 AtomicDouble (com.google.common.util.concurrent.AtomicDouble)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 ByteBuffer (java.nio.ByteBuffer)1 Path (java.nio.file.Path)1 Map (java.util.Map)1 Set (java.util.Set)1 CountDownLatch (java.util.concurrent.CountDownLatch)1