Optimize charge calculation.