optimize cpu usage