1. A computer program product for optimizing power performance in a computer system, the computer program product comprising: a tangible storage medium readable by a processing circuit and storing instructions for execution by the processing circuit for performing a method comprising: determining a current power state of a processor; executing low power state instructions of an application code on the processor in response to determining that the current power state of the processor is a low power state, the application code for performing a task on the processor, the application code comprising the low power state instructions and high power state instructions, the executing the low power state instructions comprising: collecting hardware state data; storing the hardware state data; and performing the task; and executing the high power state instructions on the processor in response to determining that the current power state of the processor is a high power state, the executing the high power state instructions comprising performing the task using the stored hardware state data as input.