1. A method for optimizing execution of a software program during class loading phase, comprising the steps of: receiving a code method of the program for compiling; detecting, by a sampling thread, whether program execution is in class loading phase, wherein program execution is in class loading phase if the class loading rate exceeds a predetermined level; reducing compiling responsive to the sampling thread detecting that program execution is in class loading phase; and returning compiling to a non-reduced state responsive to the sampling thread detecting that program execution is no longer in class loading phase.