A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2012-February/116861.html below:

[Python-Dev] PEP 414 - Unicode Literals for Python 3

[Python-Dev] PEP 414 - Unicode Literals for Python 3 [Python-Dev] PEP 414 - Unicode Literals for Python 3Serhiy Storchaka storchaka at gmail.com
Sun Feb 26 13:35:25 CET 2012
Some microbenchmarks:

$ python -m timeit -n 10000 -r 100 -s "x = 123" "'foobarbaz_%d' % x"
10000 loops, best of 100: 1.24 usec per loop
$ python -m timeit -n 10000 -r 100 -s "x = 123" "str('foobarbaz_%d') % x"
10000 loops, best of 100: 1.59 usec per loop
$ python -m timeit -n 10000 -r 100 -s "x = 123" "str(u'foobarbaz_%d') % x"
10000 loops, best of 100: 1.58 usec per loop
$ python -m timeit -n 10000 -r 100 -s "x = 123; n = lambda s: s" "n('foobarbaz_%d') % x"
10000 loops, best of 100: 1.41 usec per loop
$ python -m timeit -n 10000 -r 100 -s "x = 123; s = 'foobarbaz_%d'" "s % x"
10000 loops, best of 100: 1.22 usec per loop

There are no significant overhead to use converters.

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4