slow Python 3.0 write performance?

Benjamin Kaplan benjamin.kaplan at case.edu
Fri Dec 5 20:00:46 CET 2008


On Fri, Dec 5, 2008 at 1:54 PM, Istvan Albert <istvan.albert at gmail.com>wrote:

> 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
>
> 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) )
>
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>

This bug was already found.

http://groups.google.com/group/comp.lang.python/browse_thread/thread/9046eee09137c657#
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20081205/80a54a69/attachment.html>


More information about the Python-list mailing list