Title: Format string: add more fast-path
Type: performance Stage:
Components: Versions: Python 3.4
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: pitrou, python-dev, vstinner
Priority: normal Keywords: patch

Created on 2012-08-09 20:01 by vstinner, last changed 2012-10-02 10:54 by python-dev. This issue is now closed.

File name Uploaded Description Edit
optimize_format.patch vstinner, 2012-08-09 20:01 review
Messages (3)
msg167827 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2012-08-09 20:01
Attached patch adds tests to check that str%args and str.format(args) take all optimization opportunities for simple format strings. It takes also the fast-path when Unicode string argument when width and/or precision is set. For example, "%.3s" % "abc" now returns "abc" unmodified (instead of creating a copy). The patch also takes the fast-path when formatting integers with str%args when the argument is not an int, but an object with __int__ method.
msg171754 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-10-01 22:43
New changeset 559a430e563c by Victor Stinner in branch 'default':
Issue #15609: Optimize str%args for integer argument
msg171784 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-10-02 10:54
New changeset 5ddc7b3f2795 by Victor Stinner in branch 'default':
Issue #15609: Fix refleak introduced by my last optimization
Date User Action Args
2012-10-02 10:54:15python-devsetmessages: + msg171784
2012-10-01 22:44:22vstinnersetstatus: open -> closed
resolution: fixed
2012-10-01 22:43:09python-devsetnosy: + python-dev
messages: + msg171754
2012-08-09 20:01:46vstinnercreate