This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ztane
Recipients Demur Rumed, eric.smith, mjpieters, rhettinger, serhiy.storchaka, ztane
Date 2016-08-27.12:23:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1472300630.89.0.0751962413064.issue27078@psf.upfronthosting.co.za>
In-reply-to
Content
So does this (new opcode) count as a new feature? It would be great to give f'' strings a flying start, saying that not only they're cool, they're also faster than anything that you've used before.

Here some more mini-benchmarks with serhiy's patch2 applied, the times are pretty stable:

    % python3.6 -mtimeit -s 'x = 42' '"%s-" % x'
    10000000 loops, best of 3: 0.184 usec per loop

    % python3.6 -mtimeit -s 'x = 42' 'f"{x}-"' 
    10000000 loops, best of 3: 0.142 usec per loop

and

    % python3.6 -mtimeit -s 'x = "42"' 'f"{x}{x}"'
    10000000 loops, best of 3: 0.0709 usec per loop

    % python3.6 -mtimeit -s 'x = "42"' '"%s%s" % (x,x)'
    1000000 loops, best of 3: 0.213 usec per loop

    python3.6 -mtimeit -s 'x = "42"' '"".join((x, x))'
    10000000 loops, best of 3: 0.155 usec per loop

This is only really achievable with some kind of bytecode support.
History
Date User Action Args
2016-08-27 12:23:51ztanesetrecipients: + ztane, rhettinger, mjpieters, eric.smith, serhiy.storchaka, Demur Rumed
2016-08-27 12:23:50ztanesetmessageid: <1472300630.89.0.0751962413064.issue27078@psf.upfronthosting.co.za>
2016-08-27 12:23:50ztanelinkissue27078 messages
2016-08-27 12:23:50ztanecreate