optimize calculation data switching