Message273776
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. |
|
Date |
User |
Action |
Args |
2016-08-27 12:23:51 | ztane | set | recipients:
+ ztane, rhettinger, mjpieters, eric.smith, serhiy.storchaka, Demur Rumed |
2016-08-27 12:23:50 | ztane | set | messageid: <1472300630.89.0.0751962413064.issue27078@psf.upfronthosting.co.za> |
2016-08-27 12:23:50 | ztane | link | issue27078 messages |
2016-08-27 12:23:50 | ztane | create | |
|