Runtime optimization of SetTargetsWithInfo function.