文件太大

long count = 0; string str; fstream readf(filePath); while(getline(readf,str)) { count++; cout<<count<<" "<<str<<endl; }用以上方法读一个50多万行的trace差不多要10分钟,时间太长,求解答?
long count = 0; string str; fstream readf(filePath); while(getline(readf,str)) { count++; cout<<count<<" "<<str<<endl; }用以上方法读一个50多万行的trace差不多要10分钟,时间太长,求解答?