what exactly is difference between BufferedReader and FileIO in Python

Viewed 23

I see some saying: "BufferedReader is more efficient". But I find it's not, when I open and .read a file 500MB separately using io.BufferedReader and io.FileIO, they both consume same time all the time as I change buffer_size.

If so, why would I use BufferedReader?

Is there any difference between them?

Or say, what is BufferedReader for? If it can't get more efficient.

my code as following:

import io

def bufferio():
    with io.FileIO('out', 'rb') as fp:
        bf = io.BufferedReader(fp)
        res = bf.read()

def fileio():
    with io.FileIO('out', 'rb') as fp:
        res = fp.read()
0 Answers
Related