
On Mon, Jul 20, 2015 at 11:16 PM, Steve Dower <Steve.Dower@microsoft.com> wrote:
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.
One thing I know for a fact is that the use of % formatting instead of .format makes a significant difference in my applications. This is not surprising given these timings: $ python3 -mtimeit "'%d' % 2" 100000000 loops, best of 3: 0.00966 usec per loop $ python3 -mtimeit "'{}'.format(2)" 1000000 loops, best of 3: 0.216 usec per loop As a result, my rule of thumb is to avoid the use of .format in anything remotely performance critical. If f"" syntax is implemented as a sugar for .format - it will be equally useless for most of my needs. However, I think it can be implemented in a way that will make me consider switching away from % formatting.