Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Drill, mail # dev - Janino performance versus javax.tools.JavaCompiler


Copy link to this message
-
Janino performance versus javax.tools.JavaCompiler
Jacques Nadeau 2013-04-27, 03:16
I'm working on some of the bytecode stuff for Drill and found some
interesting random testing data:

Java6 adds a new JavaCompiler API.  Janino supports utilizing that
instead of its internal parsing.  The benefit of this is that all the
JDK 5 stuff like generics are fully supported.  Since that seemed
nice, i figured we could use that.

In initial testing, I've actually found it substantially slower than
the Janino compiler.  I ran some crappy microbenchmarks just to see
why my stuff was going so slow.  Running a basic comparison test of
the simple ExpressionEvaluator example utilizing Janino versus JDK
showed an average compile and single invocation time of ~18000 micros
on JDK versus ~950 micros on Janino.

Has anyone else experimented with this/experienced this?

Example block below (straight from Janino docs).

     ExpressionEvaluator ee = new ExpressionEvaluator("c > d ? c : d",
// expression
        int.class, // expressionType
        new String[] { "c", "d" }, // parameterNames
        new Class[] { int.class, int.class } // parameterTypes
    );

    // Evaluate it with varying parameter values; very fast.
    return  (Integer) ee.evaluate(new Object[] { // parameterValues
        new Integer(10), new Integer(11), });