[Python-Dev] PEP 393 review

Antoine Pitrou solipsis at pitrou.net
Sun Aug 28 22:27:20 CEST 2011


Le dimanche 28 août 2011 à 22:23 +0200, "Martin v. Löwis" a écrit :
> Am 28.08.2011 22:01, schrieb Antoine Pitrou:
> > 
> >> - the iobench results are between 2% acceleration (seek operations),
> >>   16% slowdown for small-sized reads (4.31MB/s vs. 5.22 MB/s) and
> >>   37% for large sized reads (154 MB/s vs. 235 MB/s). The speed
> >>   difference is probably in the UTF-8 decoder; I have already
> >>   restored the "runs of ASCII" optimization and am out of ideas for
> >>   further speedups. Again, having to scan the UTF-8 string twice
> >>   is probably one cause of slowdown.
> > 
> > I don't think it's the UTF-8 decoder because I see an even larger
> > slowdown with simpler encodings (e.g. "-E latin1" or "-E utf-16le").
> 
> But those aren't used in iobench, are they?

I was not very clear, but you can change the encoding used in iobench by
using the "-E" command-line option (while UTF-8 is the default if you
don't specify anything).

For example:

$ ./python Tools/iobench/iobench.py -t -E latin1
Preparing files...
Text unit = one character (latin1-decoded)

** Text input **

[ 400KB ] read one unit at a time...                   5.17 MB/s
[ 400KB ] read 20 units at a time...                   77.6 MB/s
[ 400KB ] read one line at a time...                    209 MB/s
[ 400KB ] read 4096 units at a time...                  509 MB/s

[  20KB ] read whole contents at once...                885 MB/s
[ 400KB ] read whole contents at once...                730 MB/s
[  10MB ] read whole contents at once...                726 MB/s

(etc.)

Regards

Antoine.




More information about the Python-Dev mailing list