17 Jul
2007
17 Jul
'07
7:13 p.m.
On Wednesday 18 July 2007, Alec Mihailovs wrote:
In this particular example,
som=0 for i in xrange(1,10000000): som=som+1.0/i if i%100000==0: print som,
works hundreds (or thousands) times faster - depending on the architecture.
Really? On my computer, typing the above into the interactive interpreter (and losing the comma on the print statement, because for some reason it isn't flushing its output after a print with no newline) produces lines of output at about 6Hz. (I'm estimating. It might be 4Hz or 10Hz. But it certainly isn't hundreds of lines per second.) My machine is an Athlon 64 3200 running in 32-bit mode. It's a little way behind the state of the art, but it's certainly not substantially behind Simon's. -- g