Patent ID: 8266606

Claim:
A computer-implemented method to optimize execution of a task by selecting one of a plurality of paths for execution of the task by a computer system, the method comprising: for each one of a set of possible code paths, determining a characteristic of performance for the code path by executing the task using the code path and observing performance, wherein observing performance further comprises counting a number of cycles needed to execute a code path; and selecting for subsequent execution of the task, the code path with a best performance characteristic; wherein the selecting comprises selecting a memory allocation module for the task, the memory allocation module comprises: partitioning a memory into a plurality of sections, wherein each section in the plurality of sections has a size smaller than a size of the memory, wherein each section in the plurality of sections is further divided into granules, and wherein each section in the plurality of sections has a granule size different than the other sections in the plurality of sections; comparing a size of an allocation request from the task to the granule size within each section of the plurality of sections in order to identify a section with a granule size that is closest to the size of the allocation request; and responsive to identifying the section with the granule size that is closest to the size of the allocation request, allocating a granule from the section with the granule size in response to the allocation request.