Examples of Benchmarker


Examples of org.fusesource.hawtdb.internal.Benchmarker

        try {
            if( setup!=null ) {
                setup.run(pff);
            }
            TxPageFile pf = pff.getTxPageFile();
            Benchmarker benchmark = new Benchmarker();
            benchmark.setSamples(samples);
            benchmark.setPeriod(period);
            benchmark.setName(action.getName());
            ArrayList<A> actors = createActors(pf, actorCount, action);
            benchmark.benchmark(actors, createMetrics(action));
        } finally {
            try {
                if( tearDown!=null ) {
                    tearDown.run(pff);
                }
View Full Code Here

Examples of spullara.util.Benchmarker

import java.util.concurrent.atomic.AtomicInteger;

public class BenchmarkTest {
    @Test
    public void testVsFor() throws Exception {
        Benchmarker bm = new Benchmarker(100000);
        List<String> list = new ArrayList<>();
        for (int i = 0; i < 100000; i++) {
            list.add("foorbar" + i);
        }
        AtomicInteger ai = new AtomicInteger();
        bm.execute("for loop", () -> {
            int i = 0;
            for (String s : list) {
                if (s.endsWith("1")) {
                    i++;
                }
            }
            ai.addAndGet(i);
        });
        bm.execute("sequential stream", () -> {
            ai.addAndGet((int) list.stream().filter(v -> v.endsWith("1")).count());
        });
        bm.execute("parallel stream", () -> {
            ai.addAndGet((int) list.stream().parallel().filter(v -> v.endsWith("1")).count());
        });
        bm.report();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.