[issue7946] Convoy effect with I/O bound threads and New GIL
Florent Xicluna
report at bugs.python.org
Mon Mar 15 16:44:42 CET 2010
Florent Xicluna <florent.xicluna at gmail.com> added the comment:
With line buffering, I see the issue.
* 6 s without thread
* 115 s with the spinning thread (varying: 60 s, 98 s)
* 16 s with the spinning thread and the last "gilinter.patch"
# Modified version of the test case, with bufsize=1
from threading import Thread
import time
def writenums(f, n):
start = time.time()
for x in range(n):
f.write("%d\n" % x)
end = time.time()
print(end-start)
def spin():
while True:
pass
t1 = Thread(target=spin)
t1.daemon=True
# Uncomment to add a thread
#t1.start()
# With line buffering
writenums(open("./nums", "w", 1), 1000000)
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7946>
_______________________________________
More information about the Python-bugs-list
mailing list