Package org.apache.jackrabbit.oak.commons

Examples of org.apache.jackrabbit.oak.commons.StopWatch


    // run the micro-benchmark
    public static void main(String... args) {
        for (int k = 0; k < 5; k++) {
            String s = "Hello \"World\" Hello \"World\" Hello \"World\" Hello \"World\" Hello \"World\" Hello \"World\" ";
            StopWatch timer = new StopWatch();
            JsopWriter w = k % 2 == 1 ? new JsopBuilder() : new JsopStream();
            for (int i = 0; i < 1000000; i++) {
                w.value(s);
                if (i % 100 == 0) {
                    w.resetWriter();
                }
            }
            System.out.println(w.getClass() + ": " + timer.seconds());
        }
        // JsopStream: 20
        // JsopBuilder: 1150
    }
View Full Code Here


    // run the micro-benchmark
    public static void main(String... args) {
        for (int k = 0; k < 5; k++) {
            // String s = "Hello World Hello World Hello World Hello World Hello World Hello World ";
            String s = "Hello \"World\" Hello \"World\" Hello \"World\" Hello \"World\" Hello \"World\" Hello \"World\" ";
            StopWatch timer = new StopWatch();
            int t2 = 0;
            for (int i = 0; i < 1000000; i++) {
                t2 += JsopBuilder.encode(s).length();
            }
            System.out.println(timer.seconds() + " dummy: " + t2);
        }
        // old: not escaped: 5691 ms; escaped: 10609 ms
        // new: not escaped: 3931 ms; escaped: 11001 ms
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.commons.StopWatch

Copyright © 2018 www.massapicom. 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.