[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. The code is probably already fast
enough.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 file adds yet about 2%. This is too small for adding new 
file. Thus I'll commit the original patch, with small style changes.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 
str.format. For f-strings it should be more significant. I'm going to revive my 
old patch and compare it with your short patch.

--
assignee:  -> serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 Py3.6 master:

$ ./python -m timeit 'f"{34276394612:15}"'
100 loops, best of 3: 0.435 usec per loop
$ ./python -m timeit 'f"{34.276394612:8.6f}"'
100 loops, best of 3: 0.589 usec per loop

It doesn't make much of a difference if you use constants or variables, BTW.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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).

--
components: Interpreter Core
files: faster_format.patch
keywords: patch
messages: 273243
nosy: scoder
priority: normal
severity: normal
status: open
title: Speed up number format spec parsing
type: performance
versions: Python 3.6
Added file: http://bugs.python.org/file44173/faster_format.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com