[New-bugs-announce] [issue4533] 3.0 file.read dreadfully slow

Terry J. Reedy report at bugs.python.org
Thu Dec 4 19:30:20 CET 2008

New submission from Terry J. Reedy <tjreedy at udel.edu>:

C.l.p poster reported that 3.0 file.read is orders of magnitude slower
than with 2.5 (but confused issue with buffer = 0).  Jerry Hill reported

"Here's a quick comparison between 2.5 and
3.0 on a relatively small 17 meg file:

C:\>c:\Python30\python -m timeit -n 1
"open('C:\\work\\temp\\bppd_vsub.csv', 'rb').read()"
1 loops, best of 3: 36.8 sec per loop

C:\>c:\Python25\python -m timeit -n 1
"open('C:\\work\\temp\\bppd_vsub.csv', 'rb').read()"
1 loops, best of 3: 33 msec per loop

That's 3 orders of magnitude slower on python3.0!"

I verified this informally on WinXP by opening and then reading
Doc/Pythonxy.chm (about 4 megs) -- an eye blink versus 3 seconds,
repeated.  Even the open seemed slower but I did not time it.
>>> f=open('Doc/Python30.chm','rb')
>>> d=f.read()

components: Interpreter Core, Library (Lib)
messages: 76915
nosy: tjreedy
severity: normal
status: open
title: 3.0 file.read dreadfully slow
type: performance
versions: Python 3.0

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list