avoid growing object in rankall.R, improve efficiency