[issue4561] Optimize new io library

Antoine Pitrou report at bugs.python.org
Tue Dec 16 02:23:12 CET 2008


Antoine Pitrou <pitrou at free.fr> added the comment:

Without Christian's patch:

[400KB.txt] read one byte/char at a time...          0.2685 MB/s (100% CPU)
[400KB.txt] read 20 bytes/chars at a time...          4.536 MB/s (98% CPU)
[400KB.txt] read one line at a time...                3.805 MB/s (99% CPU)
[400KB.txt] read 4096 bytes/chars at a time...        29.23 MB/s (100% CPU)

[ 20KB.txt] read whole contents at once...            52.42 MB/s (99% CPU)
[400KB.txt] read whole contents at once...            45.83 MB/s (100% CPU)
[ 10MB.txt] read whole contents at once...            48.78 MB/s (99% CPU)

With the patch:

[400KB.txt] read one byte/char at a time...          0.2761 MB/s (100% CPU)
[400KB.txt] read 20 bytes/chars at a time...          4.656 MB/s (99% CPU)
[400KB.txt] read one line at a time...                3.956 MB/s (98% CPU)
[400KB.txt] read 4096 bytes/chars at a time...        33.85 MB/s (100% CPU)

[ 20KB.txt] read whole contents at once...            66.17 MB/s (99% CPU)
[400KB.txt] read whole contents at once...            56.65 MB/s (99% CPU)
[ 10MB.txt] read whole contents at once...            63.69 MB/s (99% CPU)

Python 2.6's builtin file object:

[400KB.txt] read one byte/char at a time...           1.347 MB/s (97% CPU)
[400KB.txt] read 20 bytes/chars at a time...          26.65 MB/s (99% CPU)
[400KB.txt] read one line at a time...                184.4 MB/s (100% CPU)
[400KB.txt] read 4096 bytes/chars at a time...         1163 MB/s (99% CPU)

[ 20KB.txt] read whole contents at once...             1072 MB/s (100% CPU)
[400KB.txt] read whole contents at once...            889.1 MB/s (100% CPU)
[ 10MB.txt] read whole contents at once...              600 MB/s (100% CPU)

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4561>
_______________________________________


More information about the Python-bugs-list mailing list