<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
<meta content="text/html; charset=utf-8">
</head>
<body>
<div>
<div style="font-family:Calibri,sans-serif; font-size:11pt">That's almost certainly something that can be improved though, and maybe it's worth some investment from you. Remember, Python doesn't get better by magic - it gets better because someone gets annoyed
 enough about it that they volunteer to fix it (at least, that's how I ended up getting so involved :) ).<br>
<br>
My wild guess is that calling int.__format__ is the slow part, though I'd have hoped that it wouldn't be any slower for default formatting... guess not. We've got sprints coming up at PyData next week, so maybe I'll try and encourage someone to take a look
 and see what can be improved here.<br>
<br>
Cheers,<br>
Steve<br>
<br>
Top-posted from my Windows Phone</div>
</div>
<div dir="ltr">
<hr>
<span style="font-family:Calibri,sans-serif; font-size:11pt; font-weight:bold">From:
</span><span style="font-family:Calibri,sans-serif; font-size:11pt"><a href="mailto:alexander.belopolsky@gmail.com">Alexander Belopolsky</a></span><br>
<span style="font-family:Calibri,sans-serif; font-size:11pt; font-weight:bold">Sent:
</span><span style="font-family:Calibri,sans-serif; font-size:11pt">ý7/ý20/ý2015 20:28</span><br>
<span style="font-family:Calibri,sans-serif; font-size:11pt; font-weight:bold">To:
</span><span style="font-family:Calibri,sans-serif; font-size:11pt"><a href="mailto:Steve.Dower@microsoft.com">Steve Dower</a></span><br>
<span style="font-family:Calibri,sans-serif; font-size:11pt; font-weight:bold">Cc:
</span><span style="font-family:Calibri,sans-serif; font-size:11pt"><a href="mailto:eric@trueblade.com">Eric V. Smith</a>;
<a href="mailto:python-ideas@python.org">python-ideas</a></span><br>
<span style="font-family:Calibri,sans-serif; font-size:11pt; font-weight:bold">Subject:
</span><span style="font-family:Calibri,sans-serif; font-size:11pt">Re: [Python-ideas] Briefer string format</span><br>
<br>
</div>
<div>
<div dir="ltr">
<div class="gmail_extra"><br>
<div class="gmail_quote">On Mon, Jul 20, 2015 at 11:16 PM, Steve Dower <span dir="ltr">
<<a href="mailto:Steve.Dower@microsoft.com" target="_blank">Steve.Dower@microsoft.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left-width:1px; border-left-color:rgb(204,204,204); border-left-style:solid; padding-left:1ex">
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.</blockquote>
</div>
<br>
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:</div>
<div class="gmail_extra"><br>
</div>
<div class="gmail_extra">$ python3 -mtimeit "'%d' % 2"</div>
<div class="gmail_extra">100000000 loops, best of 3: 0.00966 usec per loop</div>
<div class="gmail_extra">$ python3 -mtimeit "'{}'.format(2)"</div>
<div class="gmail_extra">1000000 loops, best of 3: 0.216 usec per loop</div>
<div class="gmail_extra"><br>
</div>
<div class="gmail_extra">As a result, my rule of thumb is to avoid the use of .format in anything remotely performance critical.</div>
<div class="gmail_extra"><br>
</div>
<div class="gmail_extra">If f"" syntax is implemented as a sugar for .format - it will be equally useless for most of my needs.  However,</div>
<div class="gmail_extra">I think it can be implemented in a way that will make me consider switching away from % formatting.</div>
</div>
</div>
</body>
</html>