Optimize the getsuffix used in optim. search