Is the actual execution time after warming up the JIT the same?

On Fri, Apr 26, 2013 at 8:16 PM, Jacques Nadeau <[email protected]> wrote:

> 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), });
>

Reply via email to