How would you optimize a piece of code that is performing poorly in a production environment at CHAMP Cargosystems?