Understanding, detecting, and repairing performance bugs