A
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:
import re
pat = re.compile("sometext")
f = open("bigfile",'r')
flines = (line for line in f if pat.search(line))
c=0
for x in flines:
c+=1
print c
and bash:
grep "sometext" bigfile | wc -l
Python code 3-4 times slower on windows. And as I remember on linux
the same situation...
Buffering in open even increase time.
Is it possible to increase file reading performance?
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:
import re
pat = re.compile("sometext")
f = open("bigfile",'r')
flines = (line for line in f if pat.search(line))
c=0
for x in flines:
c+=1
print c
and bash:
grep "sometext" bigfile | wc -l
Python code 3-4 times slower on windows. And as I remember on linux
the same situation...
Buffering in open even increase time.
Is it possible to increase file reading performance?