There is a larger-scale optimality in life which can only be appreciated at the ecosystem scale. With rare exception, the skill of predators is never quite enough to wipe out their prey. This apparent suboptimality is ideal in maintaining a delicate balance that sustains all parties involved, and so avoids the self-organized criticality of extinction. There have been exceptions, which makes the history of life unpredictably fascinating. (The self-engineered mass extinction event mankind is presently engaged in at full tilt illustrates the fantastic idiocy of a creature that arrogantly considers itself supreme. For a connoisseur of melodrama, the irony is delicious.)
Many traits are evolved refinements from baser originations. The refinement process is not necessarily toward biodynamic perfection. It may instead be toward something sensible but suboptimal, as trade-offs are involved. Evolution driven by perception is exemplary.