[issue27078] Make f'' strings faster than .format: BUILD_STRING opcode?
Eric V. Smith
report at bugs.python.org
Sun Jul 10 18:18:43 EDT 2016
Eric V. Smith added the comment:
> And the expected performance for optimal `f'X is {x}'` code would
> be *faster* than `"'X is %s' % (x,)"` which still needs to
> interpret the string at runtime, and build a proper tuple object
> on stack.
That's not necessarily true. The f-string version still needs to invoke the .format() method on the object, instead of only working for a handful of hard-coded types.
I'm not saying there aren't optimization opportunities, but it may be that %-formatting is always faster.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27078>
_______________________________________
More information about the Python-bugs-list
mailing list