32 lines
962 B
Plaintext
32 lines
962 B
Plaintext
From: cgw at fnal.gov (Charles G Waldman)
|
|
Date: Thu, 15 Apr 1999 20:53:50 GMT
|
|
Subject: for in benchmark interested
|
|
In-Reply-To: <14102.15523.573321.443195@bitdiddle.cnri.reston.va.us>
|
|
References: <37157CE7.EFB470CA@inka.de>
|
|
<14102.15523.573321.443195@bitdiddle.cnri.reston.va.us>
|
|
Message-ID: <14102.20958.460408.832042@buffalo.fnal.gov>
|
|
X-UID: 119
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|