javaoptimizationjavac

Compile Java without optimization?


I'm working on some of the problems in Programming Pearls and I'd like to get a sense for the runtime of various programs in Java. However the optimizing compiler is making this difficult. Is there a way to run javac on a Mac without having the compiler make any optimizations?


Solution

  • @Andrew Thompson is correct, the JIT is the main source of optimizations with java.

    To run java without the JIT:

     java -Xint ...