Package org.apache.jackrabbit.mk.util

Examples of org.apache.jackrabbit.mk.util.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 ";
            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


    // 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 < 10000000; i++) {
                t2 += JsopBuilder.encode(s).length();
            }
            System.out.println(timer.seconds());
        }
        // old: not escaped: 5691 ms; escaped: 10609 ms
        // new: not escaped: 3931 ms; escaped: 11001 ms
    }
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\" ";
            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

            // 100 children with the dummy data: 100'000 characters
            for (int j = 0; j < 100; j++) {
                w.put("child" + j, data);
            }
            String jsop = w.toString();
            StopWatch timer = new StopWatch();
            for (int j = 0; j < 10000; j++) {
                JsopObject o = (JsopObject) Jsop.parse(jsop);
                assertEquals(data, o.get("child99"));
            }
            System.out.println(timer.seconds() + " lengthIndex=" + lengthIndex);
        }
    }
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 < 10000000; i++) {
                t2 += JsopBuilder.encode(s).length();
            }
            System.out.println(timer.seconds());
        }
        // old: not escaped: 5691 ms; escaped: 10609 ms
        // new: not escaped: 3931 ms; escaped: 11001 ms
    }
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 < 10000000; 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

    // 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\" ";
            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 < 10000000; i++) {
                t2 += JsopBuilder.encode(s).length();
            }
            System.out.println(timer.seconds());
        }
        // 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.mk.util.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.