Statistical optimization of performance and leakage