next up previous
Next: parallel code Up: Optimization Previous: compact code

efficient code

However, optimization does not necessarily lead to the most compact code. Some optimizations achieve greater efficiency through more complex code. An example of this involves the technique of ``unrolling the loop''. The seed program contains a loop which copies one byte from mother to daughter. The program copies its entire genome by executing this loop eighty times. Evolved algorithms have been found to copy two or three bytes per loop, thereby increasing efficiency.

Efficiency can be calculated by dividing the total number of machine instructions executed in the replication process by the number of bytes in the organism, resulting in a measure of cycles executed per byte copied. For example, an eighty-two byte ancestor executed 8.39 cycles per byte copied. Its smallest descendant was twenty-tree bytes, copied one byte per loop, and executed at best, 4.96 cycles per byte copied. A somewhat larger descendant was twenty-six bytes, copied two bytes per loop, and executed only 3.73 cycles per byte copied. Another descendant was forty-three bytes, copied three bytes per loop, and executed only 3.33 cycles per byte copied.

Thomas S.Ray
Mon Jul 15 15:51:28 JST 1996