New Insights and Algorithms for Optimal Diagonal Preconditioning