python vs. grep

2008-05-06 Thread Anton Slesarev
I've read great paper about generators: http://www.dabeaz.com/generators/index.html Author say that it's easy to write analog of common linux tools such as awk,grep etc. He say that performance could be even better. But I have some problem with writing performance grep analog. It's my script:

Re: python vs. grep

2008-05-07 Thread Anton Slesarev
I try to save my time not cpu cycles) I've got file which I really need to parse: -rw-rw-r-- 1 xxx xxx 3381564736 May 7 09:29 bigfile That's my results: $ time grep "python" bigfile | wc -l 2470 real0m4.744s user0m2.441s sys 0m2.307s And python scripts: import sys if len(

Re: python vs. grep

2008-05-07 Thread Anton Slesarev
On May 7, 7:22 pm, Pop User <[EMAIL PROTECTED]> wrote: > Anton Slesarev wrote: > > > But I have some problem with writing performance grep analog. > > I don't think you can ever catch grep. Searching is its only purpose in > life and its very good at it. You