[issue27818] Speed up number format spec parsing

2016-08-30 Thread STINNER Victor
STINNER Victor added the comment: > Moving some functions to template file adds yet about 2%. This is too small > for adding new file. I agree. I checked just after writing my previous comment and in fact str%args doesn't use a C template neither, it also uses PyUnicode_READ() which is fine.

[issue27818] Speed up number format spec parsing

2016-08-30 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue27818] Speed up number format spec parsing

2016-08-29 Thread Roundup Robot
Roundup Robot added the comment: New changeset 9bddf9e72c96 by Serhiy Storchaka in branch 'default': Issue #27818: Speed up parsing width and precision in format() strings for https://hg.python.org/cpython/rev/9bddf9e72c96 -- nosy: +python-dev ___

[issue27818] Speed up number format spec parsing

2016-08-29 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I haven't found my old patch and tried to reimplement it. Added new file in stringlib. The original patch speeds up microbenchmarks only on about 4% on my computer (32-bit Linux). This is small, but the patch is simple. Moving some functions to template

[issue27818] Speed up number format spec parsing

2016-08-22 Thread STINNER Victor
STINNER Victor added the comment: -while (pos ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue27818] Speed up number format spec parsing

2016-08-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: LGTM. I expect that with the patch for issue27078 the effect of this optimization is even more significant. Years ago I wrote much larger patch that includes similar but even more aggressive microoptimization. But the effect was not very impressive for

[issue27818] Speed up number format spec parsing

2016-08-20 Thread Stefan Behnel
Stefan Behnel added the comment: You can easily see it by running timeit on fstrings, e.g. patched: $ ./python -m timeit 'f"{34276394612:15}"' 100 loops, best of 3: 0.352 usec per loop $ ./python -m timeit 'f"{34.276394612:8.6f}"' 100 loops, best of 3: 0.497 usec per loop and original

[issue27818] Speed up number format spec parsing

2016-08-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: What benchmarks you used? -- nosy: +serhiy.storchaka ___ Python tracker ___

[issue27818] Speed up number format spec parsing

2016-08-20 Thread Ned Deily
Changes by Ned Deily : -- nosy: +eric.smith stage: -> patch review ___ Python tracker ___

[issue27818] Speed up number format spec parsing

2016-08-20 Thread Stefan Behnel
New submission from Stefan Behnel: I noticed that quite some time during number formatting is spent parsing the format spec. The attached patch speeds up float formatting by 5-15% and integer formatting by 20-30% for me overall when using f-strings (Ubuntu 16.04, 64bit). --