Demur Rumed added the comment:

fstrtup2.patch is a bit more of an involved optimization for when we are 
joining 2 strings. Instead it emits BINARY_ADD. This may be considered too 
'niche' since it only triggers when the substitution occurs at the start or end 
of a string & there is only one substitution

However, it reduces the "X is {x}" testcase on my machine to 4.9 usec

Interesting thing, to consider ceiling of what we can do,

Prefixing ./python -m timeit -s "x=1"
'%s'%x 1.08 usec
'%s'%(x,) 2.04 usec
str(x) 2.9 usec
f'{x}' 3.65 usec

So we should not be aiming to compete with %. It may be worthy to convert the 
code to generate "x is {}".format calls tho

----------
Added file: http://bugs.python.org/file43704/fstrtup2.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27078>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to