[Python-Dev] Python 3.0.1 (io-in-c)

Antoine Pitrou solipsis at pitrou.net
Tue Jan 27 23:54:32 CET 2009


Daniel Stutzbach <daniel <at> stutzbachenterprises.com> writes:
> 
> Would it be much trouble to also compare performance with Python 2.6?


Here are the results on trunk. Keep in mind Text IO, while it's still `open("r",
filename)`, does not mean the same thing.


=== 2.7 I/O (trunk) ===

** Binary input **

[ 400KB ] read one unit at a time...                   1.48 MB/s
[ 400KB ] read 20 units at a time...                   29.2 MB/s
[ 400KB ] read 4096 units at a time...                 1038 MB/s

[  20KB ] read whole contents at once...               1145 MB/s
[ 400KB ] read whole contents at once...                891 MB/s
[  10MB ] read whole contents at once...                966 MB/s

[ 400KB ] seek forward one unit at a time...          0.893 MB/s
[ 400KB ] seek forward 1000 units at a time...          568 MB/s
[ 400KB ] alternate read & seek one unit...            1.11 MB/s
[ 400KB ] alternate read & seek 1000 units...           563 MB/s

** Text input **

[ 400KB ] read one unit at a time...                   1.41 MB/s
[ 400KB ] read 20 units at a time...                   28.4 MB/s
[ 400KB ] read one line at a time...                    207 MB/s
[ 400KB ] read 4096 units at a time...                 1060 MB/s

[  20KB ] read whole contents at once...               1196 MB/s
[ 400KB ] read whole contents at once...                841 MB/s
[  10MB ] read whole contents at once...                966 MB/s

[ 400KB ] seek forward one unit at a time...          0.873 MB/s
[ 400KB ] seek forward 1000 units at a time...          589 MB/s

** Binary append **

[  20KB ] write one unit at a time...                 0.887 MB/s
[ 400KB ] write 20 units at a time...                  15.8 MB/s
[ 400KB ] write 4096 units at a time...                1071 MB/s
[  10MB ] write 1e6 units at a time...                 1523 MB/s

** Text append **

[  20KB ] write one unit at a time...                  1.33 MB/s
[ 400KB ] write 20 units at a time...                  22.9 MB/s
[ 400KB ] write 4096 units at a time...                1244 MB/s
[  10MB ] write 1e6 units at a time...                 1540 MB/s

** Binary overwrite **

[  20KB ] modify one unit at a time...                0.867 MB/s
[ 400KB ] modify 20 units at a time...                 15.3 MB/s
[ 400KB ] modify 4096 units at a time...                446 MB/s

[ 400KB ] alternate write & seek one unit...          0.237 MB/s
[ 400KB ] alternate write & seek 1000 units...          151 MB/s
[ 400KB ] alternate read & write one unit...          0.221 MB/s
[ 400KB ] alternate read & write 1000 units...          153 MB/s

** Text overwrite **

[  20KB ] modify one unit at a time...                 1.32 MB/s
[ 400KB ] modify 20 units at a time...                 22.5 MB/s
[ 400KB ] modify 4096 units at a time...                509 MB/s




More information about the Python-Dev mailing list