[issue5502] io-c: TextIOWrapper is faster than BufferedReader but not protected by a lock
STINNER Victor
report at bugs.python.org
Wed Mar 18 02:16:12 CET 2009
New submission from STINNER Victor <victor.stinner at haypocalc.com>:
TextIOWrapper.readline() is much faster (eg. 72 ms vs 95 ms) than
BufferedReader.readline(). It's because BufferedReader always acquires
the file lock, whereas TextIOWrapper only acquires the file lock when
the buffer is empty.
I would like a BufferedReader.readline() as fast as
TextIOWrapper.readline(), or faster!
Why BufferedReader's attributes are protected by a lock whereas
TextIOWrapper's attributes are not?
Does it mean that TextIOWrapper may crash if two threads calls
readline() (or different methods) at the "same time"?
How does Python 2.x and 3.0 fix this issue?
----------
components: Library (Lib)
messages: 83724
nosy: haypo, pitrou
severity: normal
status: open
title: io-c: TextIOWrapper is faster than BufferedReader but not protected by a lock
versions: Python 3.1
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5502>
_______________________________________
More information about the Python-bugs-list
mailing list