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/2008-May/079925.html below:

[Python-Dev] optimization required: .format() is much slower than %

[Python-Dev] optimization required: .format() is much slower than % [Python-Dev] optimization required: .format() is much slower than %Nick Coghlan ncoghlan at gmail.com
Fri May 30 11:47:35 CEST 2008
Simon Cross wrote:
> It struct me as odd that this one case shows such a big difference
> while the others show less of one.

I believe the %-formatting code has some optimisations in place where it 
realises it can just increment the reference count of the passed in 
string and return that, rather than having to build a new string object.

As for why you didn't see any differences in a couple of your tests: the 
.format() call wasn't actually substituting anything.

Unfortunately, the reasons why .format() doesn't complain about extra 
arguments never made it into the PEP. They can be found here:
http://mail.python.org/pipermail/python-dev/2006-May/065062.html

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org
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