Optimization of the Performance of High-Brightness Electron Guns