1. A computer-implemented method for optimizing a manner in which a software code is executed, comprising: during a compilation of the software code: determining, for a dynamic attribute associated with the software code, an expected value that the dynamic attribute will take on at a runtime of the software code, wherein the software code is dynamically typed, and determining the expected value comprises applying a static type inference analysis to the dynamically typed software code; generating an un-optimized version of the software code, wherein the un-optimized version is based on an assumption that the dynamic attribute will not have the expected value; generating an optimized version of the software code, wherein the optimized version is based on an assumption that the dynamic attribute will have the expected value; and modifying the optimized version to include code that is configured to cause the optimized version during execution to: transition into executing to the un-optimized version in an event it is determined that the dynamic attribute does not have the expected value, and revert to executing the optimized version subsequent to the transition, in the event it is determined that in at least a threshold number of instances observed subsequent to the transition the dynamic attribute has had the expected value.