STINNER Victor <victor.stin...@haypocalc.com> added the comment: 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. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue13624> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com