optimize Frame::apply method