What you want is correctness preserving transformations. Add to this some metrics such as code size, execution speed.