Christian Heimes added the comment:

I first suspected that file based IO involves too many syscalls and context 
switches. However ``strace -c`` showed only minor differences in the amount of 
syscalls. The difference between read() and recvfrom() should not make any 
difference.

perf revealed that the makefile() test uses much more CPU cycles. A quick check 
with python3.3 -m profile points to Python method call overhead. Five methods 
are called more than 122,000 times each and a couple of attributes are checked, 
too. Perhaps we can optimize away _checkReadable() and _checkClosed()?

I think I know what's going on here. For socket IO readline() uses a readahead 
buffer size of 1. For each char a cascade of Python functions is called. 
os.fdopen() uses a default buffering of 4096 (or more) so it's not affected.

----------
Added file: http://bugs.python.org/file30770/perf.txt

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18329>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to