
Sounds like you deserve the congratulations then :) But when you've confirmed that string formatting is something that can be changed to improve performance (specifically parsing the format string in this case), you have options regardless of the default optimization. For instance, you probably want to preallocate a list, format and set each non-string item, then use .join (or if possible, write directly from the list without the intermediate step of producing a single string). Making f"" strings subtly faster isn't going to solve your performance issue, and while I'm not advocating wastefulness, this looks like a premature optimization, especially when put alongside the guaranteed heap allocations and very likely IO that are also going to occur. Cheers, Steve Top-posted from my Windows Phone ________________________________ From: Alexander Belopolsky<mailto:alexander.belopolsky@gmail.com> Sent: 7/20/2015 19:44 To: Steve Dower<mailto:Steve.Dower@microsoft.com> Cc: Eric V. Smith<mailto:eric@trueblade.com>; python-ideas<mailto:python-ideas@python.org> Subject: Re: [Python-ideas] Briefer string format On Mon, Jul 20, 2015 at 10:10 PM, Steve Dower <Steve.Dower@microsoft.com<mailto:Steve.Dower@microsoft.com>> wrote: If text formatting is your bottleneck, congratulations on fixing your network, disk, RAM and probably your users. Thank you, but one of my servers just spent 18 hours loading 10GB of XML data into a database. Given that CPU was loaded 100% all this time, I suspect neither network nor disk and not even RAM was the bottleneck. Since XML parsing was done by C code and only formatting of database INSERT instructions was done in Python, I strongly suspect string formatting had a sizable carbon footprint in this case. Not all string formatting is done for human consumption.