1. A method in a data processing system comprising the automated steps of: obtaining statistics regarding a program during runtime; analyzing the statistics; identifying a part of the program to optimize based on the analysis; determining an optimization question related to the identified part of the program; recompiling the identified part of the program with instrumentation to determine an answer to the optimization question; running the program with the instrumentation to obtain the answer to the question; determining whether an answer to the question can be obtained from running the program with the instrumentation; when an answer to the question can be obtained, determining the answer to the optimization question based on results from the instrumentation; when an answer to the question cannot be obtained, recompiling the program with additional instrumentation; and optimizing the program based on the answer to the optimization question.