optimize recording cpu usage