1. A method of dynamically optimizing code, comprising: simultaneously optimizing and executing application code on a machine, the optimizing comprising: selecting a portion of the application code; determining whether to apply at least one of a group of optimizations to the portion; and responsive to the determining, converting the portion to a transaction and applying the at least one of the group of optimizations to the portion, the transaction having a property, that when the transaction is executed, the transaction is either atomically committed or atomically aborted.