for in benchmark interested
Charles G Waldman
cgw at fnal.gov
Thu Apr 15 16:53:50 EDT 1999
But won't this break apart words that happen to span across a
500000-byte blocks boundary?
Jeremy Hylton writes:
> The Python version would be faster if you used sys.stdin.read instead
> of sys.stdin.readlines. I'm not sure why you need to split the input
> into lines before you split it into words; it seems like an
> unnecessary step.
> while 1:
> buf = read(500000)
> if buf:
> for key in string_split(buf):
> dict[key] = dict_get(key, 0) + 1
> else:
> return dict
More information about the Python-list
mailing list