Message149703
Oh, Antoine told me that I missed the -s command line argument to timeit:
$ cat bench.sh
echo -n "ASCII: "
./python -m timeit -s 'x="A"*50000' 'x.encode("utf-8")'
echo -n "UCS-1: "
./python -m timeit -s 'x="\xe9"*50000' 'x.encode("utf-8")'
echo -n "UCS-2: "
./python -m timeit -s 'x="\u20ac"*50000' 'x.encode("utf-8")'
echo -n "UCS-4: "
./python -m timeit -s 'x="\U0010FFFF"*50000' 'x.encode("utf-8")'
Python 3.2:
ASCII: 10000 loops, best of 3: 28.2 usec per loop
UCS-1: 10000 loops, best of 3: 59.1 usec per loop
UCS-2: 10000 loops, best of 3: 88.8 usec per loop
UCS-4: 1000 loops, best of 3: 254 usec per loop
Python 3.3:
ASCII: 1000000 loops, best of 3: 2.01 usec per loop
UCS-1: 10000 loops, best of 3: 95.8 usec per loop
UCS-2: 1000 loops, best of 3: 201 usec per loop
UCS-4: 10000 loops, best of 3: 151 usec per loop
The results look to be similar. |
|
Date |
User |
Action |
Args |
2011-12-17 20:24:44 | vstinner | set | recipients:
+ vstinner, loewis, jcea, pitrou, ezio.melotti |
2011-12-17 20:24:44 | vstinner | set | messageid: <1324153484.48.0.638466959595.issue13624@psf.upfronthosting.co.za> |
2011-12-17 20:24:43 | vstinner | link | issue13624 messages |
2011-12-17 20:24:43 | vstinner | create | |
|