Attaching a new patch with better performance characteristics than my
previous one, and the non-blocking test rewritten in a sane way.
Some timeit runs:
-s "import io; f=io.open('/dev/null', 'wb'); s=b'a'*1" "for i in xrange(100): f.write(s)"
without patch: 533 usec per loop
with patch: 724 usec per loop
with builtin open(): 59.6 usec per loop
-s "import io; f=io.open('/dev/null', 'wb'); s=b'a'*100" "for i in xrange(100): f.write(s)"
without patch: 563 usec per loop
with patch: 768 usec per loop
with builtin open(): 67.8 usec per loop
-s "import io; f=io.open('/dev/null', 'wb'); s=b'a'*10000" "for i in xrange(100): f.write(s)"
without patch: 1.35 msec per loop
with patch: 1.34 msec per loop
with builtin open(): 194 usec per loop
-s "import io; f=io.open('/dev/null', 'wb'); s=b'a'*100000" "for i in xrange(100): f.write(s)"
without patch: 4.92 msec per loop
with patch: 1.34 msec per loop
with builtin open(): 199 usec per loop
-s "import io; f=io.open('/dev/null', 'wb'); s=b'a'*1000000" "for i in xrange(100): f.write(s)"
without patch: 173 msec per loop
with patch: 1.35 msec per loop
with builtin open(): 194 usec per loop |