This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author flox
Recipients DazWorrall, alex, brian.curtin, carljm, coderanger, dabeaz, eric.smith, flox, jhylton, karld, kevinwatters, loewis, mahmoudimus, pitrou, rcohen, rh0dium, tarek
Date 2010-03-15.15:44:40
SpamBayes Score 6.3989654e-09
Marked as misclassified No
Message-id <1268667882.31.0.71789595284.issue7946@psf.upfronthosting.co.za>
In-reply-to
Content
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)
History
Date User Action Args
2010-03-15 15:44:42floxsetrecipients: + flox, loewis, jhylton, pitrou, eric.smith, kevinwatters, tarek, karld, carljm, coderanger, alex, brian.curtin, DazWorrall, rh0dium, rcohen, dabeaz, mahmoudimus
2010-03-15 15:44:42floxsetmessageid: <1268667882.31.0.71789595284.issue7946@psf.upfronthosting.co.za>
2010-03-15 15:44:40floxlinkissue7946 messages
2010-03-15 15:44:40floxcreate