In this study, within the framework of Fokker-Planck equation, and using the method of characteristics as well as the variational method, performance of thermodynamic machines is optimized by reducing the irreversible work Wirr. Upper bounds of output work W , output power P , and energy efficiency η are obtained. Examples with explicit expressions for W, P and η are also presented.