optimize readfile function

like title.