Re: Slow network reading?

2006-05-13 Thread Andrew MacIntyre
Ivan Voras wrote: Andrew MacIntyre wrote: Comparative CPU memory utilisation statistics, not to mention platform and version of Python, would be useful hints... During benchmarking, all versions cause all CPU to be used, but Python version has ~1.5x more CPU time allocated to it than

Re: Slow network reading?

2006-05-13 Thread Ivan Voras
Andrew MacIntyre wrote: That's only because I need the .readline() function. In C, I'm using fgets() (with the expectation that iostream will buffer data). The readline method of the file object lookalike returned by makefile implements all of the line splitting logic in Python code, which

Re: Slow network reading?

2006-05-12 Thread Ivan Voras
Andrew MacIntyre wrote: Comparative CPU memory utilisation statistics, not to mention platform and version of Python, would be useful hints... During benchmarking, all versions cause all CPU to be used, but Python version has ~1.5x more CPU time allocated to it than PHP. Python is 2.4.1

Re: Slow network reading?

2006-05-11 Thread Andrew MacIntyre
Ivan Voras wrote: def query(self, sql): self.sf.write(SQL %s\r\n % sql) self.sf.flush() resp = self.sf.readline().rstrip() m = SQLCacheD.re_rec.match(resp) if m != None: # only if some rows are returned (SELECT) n_rows =

Slow network reading?

2006-05-10 Thread Ivan Voras
I have a simple network protocol client (it's a part of this: http://sqlcached.sourceforge.net) implemented in Python, PHP and C. Everything's fine, except that the Python implementation is the slowest - up to 30% slower than the PHP version (which implements exactly the same logic, in a