slow Python 3.0 write performance?
Bruno Desthuilliers
bdesth.quelquechose at free.quelquepart.fr
Fri Dec 5 13:52:35 EST 2008
Istvan Albert a écrit :
> Could someone run the code below on both Python 2.5 and 3.0
>
> For me (on Windows) it runs over 7 times slower with Python 3.0
Already covered, I think:
http://groups.google.com/group/comp.lang.python/browse_frm/thread/9046eee09137c657#
> import time
>
> lo, hi, step = 10**5, 10**6, 10**5
>
> # writes increasingly more lines to a file
> for N in range(lo, hi, step):
> fp = open('foodata.txt', 'wt')
> start = time.time()
> for i in range( N ):
> fp.write( '%s\n' % i)
> fp.close()
> stop = time.time()
> print ( "%s\t%s" % (N, stop-start) )
>
>
>
More information about the Python-list
mailing list