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

Scott David Daniels Scott.Daniels at Acm.Org
Wed Jan 28 08:05:32 CET 2009


Raymond Hettinger wrote:
> 
> [Antoine Pitrou]
>> Now here are some performance figures. Text I/O is done in utf-8 with 
>> universal
>> newlines enabled:
> 
> That's a substantial boost.
> How does it compare to Py2.x equivalents?

Comparison of three cases (including performance rations):
                                        MB/S     MB/S    MB/S
                                        in C  in py3k  in 2.7 C/3k 2.7/3k
** Binary append **
  10M write 1e6 units at a time       1529.00 728.000 1523.000 2.10  2.09
  20K write one unit at a time           0.668  0.150    0.887 4.45  5.91
400K write 20 units at a time          12.200  2.880   15.800 4.24  5.49
400K write 4096 units at a time       722.00 346.000 1071.000 2.09  3.10
** Binary input **
  10M read whole contents at once      980.00 274.000  966.000 3.58  3.53
  20K read whole contents at once      924.00 443.000 1145.000 2.09  2.58
400K alternate read & seek 1000 units 490.000 81.200  563.000 6.03  6.93
400K alternate read & seek one unit     1.330  0.082    1.11 16.20 13.52
400K read 20 units at a time           27.200  3.440   29.200 7.91  8.49
400K read 4096 units at a time        845.00 246.000 1038.000 3.43  4.22
400K read one unit at a time            1.64   0.174    1.480 9.43  8.51
400K read whole contents at once      883.00 216.000  891.000 4.09  4.13
400K seek forward 1000 units a time   516.00 182.000  568.000 2.84  3.12
400K seek forward one unit at a time    0.528  0.188    0.893 2.81  4.75
** Binary overwrite **
  20K modify one unit at a time          0.677  0.123    0.867 5.50  7.05
400K alternate read & write 1000 unit 276.000 41.100  153.000 6.72  3.72
400K alternate read & write one unit    0.827  0.045    0.22 18.46  4.93
400K alternate write & seek 1000 unit 173.000 71.400  151.000 2.42  2.11
400K alternate write & seek one unit    0.212  0.082    0.237 2.60  2.90
400K modify 20 units at a time         12.100  2.340   15.300 5.17  6.54
400K modify 4096 units at a time      382.00 213.000  446.000 1.79  2.09
** Text append **
  10M write 1e6 units at a time        261.00 218.000 1540.000 1.20  7.06
  20K write one unit at a time           0.983  0.081    1.33 12.08 16.34
400K write 20 units at a time          16.000  1.510   22.90 10.60 15.17
400K write 4096 units at a time       236.00 118.000 1244.000 2.00 10.54
** Text input **
  10M read whole contents at once       89.700 68.700  966.000 1.31 14.06
  20K read whole contents at once      108.000 70.500 1196.000 1.53 16.96
400K read 20 units at a time           29.200  3.800   28.400 7.68  7.47
400K read 4096 units at a time         97.400 34.900 1060.000 2.79 30.37
400K read one line at a time           71.700  3.690  207.00 19.43 56.10
400K read one unit at a time            2.280  0.218    1.41 10.46  6.47
400K read whole contents at once      112.000 81.000  841.000 1.38 10.38
400K seek forward 1000 units at a time 87.400 67.300  589.000 1.30  8.75
400K seek forward one unit at a time    0.090  0.071    0.873 1.28 12.31
** Text overwrite **
  20K modify one unit at a time          0.296  0.072    1.320 4.09 18.26
400K modify 20 units at a time          5.690  1.360   22.500 4.18 16.54
400K modify 4096 units at a time      151.000 88.300  509.000 1.71  5.76


--Scott David Daniels
Scott.Daniels at Acm.Org



More information about the Python-Dev mailing list