python disk i/o speed

Chirayu thephoenix235 at gmx.net
Wed Aug 7 15:52:32 EDT 2002


one additional change might get quite some more speed.

def filterfile2(inname, outname):
     localint = int
     out = file(outname, 'w')
     for line in file(inname):
         x, y, z = line.split()
         sum = localint(x) + localint(y) + localint(z)
         print >>out, line, sum

ps: i'm new to python and have just fallen in love with the language. 3 
cheers to everyone who's a part of the team including all the people in 
this group who are very helpful.


At 04:07 PM 8/7/02 +0000, you wrote:
>nnes wrote:
>
>def filterfile2(inname, outname):
>     localint = int
>     out = file(outname, 'w')
>     for line in file(inname):
>         x, y, z = line.split()
>         sum = localint(x) + localint(y) + localint(z)
>         newstr = ' '.join((x, y, z, sum))
>         out.write(newstr + '\n')
>
>i don't have a 7MB file ready to test these on, but it'd be interesting to 
>see the differences.


----------
MERRILY MERRILY MERRILY MERRILY Life is but a dream.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20020808/38ef39ec/attachment.html>


More information about the Python-list mailing list