On Fri, Jan 9, 2009 at 1:04 PM, Johannes Bauer <dfnsonfsdu...@gmx.de> wrote: > Hello group,
Hello. (...) > Which takes about 40 seconds. I want the niceness of Python but a little > more speed than I'm getting (I'd settle for factor 2 or 3 slower, but > factor 30 is just too much). > > Can anyone point out how to solve this efficiently in Python? Johannes, your 2 programs, 1 in Python and the other in C do _not_ produce the same result. I have tested this against a randomly generated file from /dev/urandom (10M). Yes the Python one is much slower, but I believe it's bebcause the Python implementation is _correct_ where teh C one is _wrong_ :) The resulting test.bin.pgm from python is exactly 3.5M (from 10M). The resulting test.bin.pgm from the C version is 16K. Something is not quite right here :) cheers James -- http://mail.python.org/mailman/listinfo/python-list