Package org.jruby.parser

Examples of org.jruby.parser.DefaultRubyParser


            byte[] bytes = getContents(args);
            int iterations = getIterations(args);
            int[] parsers = getParsers(args);

            System.out.println("Parsing " + args[0] + " " + iterations + " times");
            DefaultRubyParser parser = new DefaultRubyParser();
            parser.setWarnings(new NullWarnings(null));
            Ruby runtime = Ruby.getGlobalRuntime();
            RubyInstanceConfig rconfig = new RubyInstanceConfig();
            ParserConfiguration config = new ParserConfiguration(runtime, 0, false, false, true, rconfig);

            for (int x = 0; x < parsers.length; x++) {
                System.out.println("Benching parse with " + (parsers[x] == 0 ? "InputStream" : "ByteArray") + "LexerSource");
                long start = System.nanoTime();
                for (int i = 0; i < iterations; i++) {
                    parser.parse(config, getLexerSource(args[0], bytes, config, parsers[x] == 0));
                }
                System.out.println("Parse took: " + ((System.nanoTime() - start) * 1.0 / 1000000.0) + "ms");
            }
        } catch (Exception e) {
            System.err.println("Parse bench failed: " + e.getMessage());
View Full Code Here

TOP

Related Classes of org.jruby.parser.DefaultRubyParser

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.