Re: something about performence

2011-06-21 Thread Terry Reedy
On 6/20/2011 10:59 PM, king6c...@gmail.com wrote: > Hi, > I have two large files,each has more than 2 lines,and each line > consists of two fields,one is the id and the other a value, > the ids are sorted. > > for example: > > file1 > (uin_a y) > 1 1245 > 2 12333 > 3 324543 > 5 34645

Re: something about performence

2011-06-21 Thread Ken Seehart
On 6/20/2011 11:56 PM, king6c...@gmail.com wrote: > Thanks for your reply,Ken :) > I found the two files ends with the same id……so I am lazy^-^ > I tried psyco,and unfortunately it costs nearly the same time as before. > Is it true that we can only get str from files in Python? > Nope^_* . There ar

Re: something about performence

2011-06-21 Thread Vijay Murthy
I just wrote something. I could not run a profiler or analyze the timing but I felt it was effecient. Have a look and see if it helps: from itertools import * def sep_add(line1, line2): if line1 and line2: val1 = line1.split() val2 = line2.split() if (val1 and val2) an

Re: something about performence

2011-06-20 Thread Ken Seehart
On 6/20/2011 10:31 PM, Ken Seehart wrote: > On 6/20/2011 7:59 PM, king6c...@gmail.com wrote: >> Hi, >> I have two large files,each has more than 2 lines,and each >> line consists of two fields,one is the id and the other a value, >> the ids are sorted. >> >> for example: >> >> file1 >> (uin

Re: something about performence

2011-06-20 Thread Ken Seehart
On 6/20/2011 7:59 PM, king6c...@gmail.com wrote: > Hi, > I have two large files,each has more than 2 lines,and each > line consists of two fields,one is the id and the other a value, > the ids are sorted. > > for example: > > file1 > (uin_a y) > 1 1245 > 2 12333 > 3 324543 > 5 3464565 >