optimize predict performance