In Python 3.6 and later, the fastest way to join strings is f-string, or ast.JoinedStr at AST level. Last time I experimented, doing f'text {item}' got about 10% speed improvement over using ''.join("text ", item) for the case of a message with a single interpolation.
Should be straightforward to modify StringJoin to do this, the hardest part is testing when we have to support Python 3.5 and Python 2.7. Probably we want a mechanism to switch it off for most of the tests, so that we don't have to change lots of tests.
In Python 3.6 and later, the fastest way to join strings is f-string, or
ast.JoinedStr
at AST level. Last time I experimented, doingf'text {item}'
got about 10% speed improvement over using''.join("text ", item)
for the case of a message with a single interpolation.Should be straightforward to modify StringJoin to do this, the hardest part is testing when we have to support Python 3.5 and Python 2.7. Probably we want a mechanism to switch it off for most of the tests, so that we don't have to change lots of tests.