This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients loewis, mark.dickinson, pitrou, serhiy.storchaka, vstinner
Date 2012-05-08.10:38:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1336473684.4987.42.camel@raxxla>
In-reply-to <CAMpsgwYqLwoim_SqJkJT=HtKBo8H3oy1S8ymtW5Q_PbBDxvXtw@mail.gmail.com>
Content
> "x={}".format(123) uses a temporary buffer for "123".

This, apparently, is inevitable. I doubt that it is able to considerably
optimize, not worsened str(int) (which is optimal for current
algorithm). Note that the more complex formatting (with width) will
still require the temporary buffer.

Be very careful not to cause regress.

>  Using
> _PyUnicodeWriter even to format 123 would avoid a malloc() and a copy of
> the characters.

Fill the ascii buffer and then copying can be cheaper than using
_PyUnicodeWriter with general non-ascii string.
History
Date User Action Args
2012-05-08 10:38:53serhiy.storchakasetrecipients: + serhiy.storchaka, loewis, mark.dickinson, pitrou, vstinner
2012-05-08 10:38:52serhiy.storchakalinkissue14744 messages
2012-05-08 10:38:52serhiy.storchakacreate