Roundup Robot added the comment:
New changeset 27461e6a7763 by Victor Stinner in branch 'default':
Issue #19513: Disable overallocation of the PyUnicodeWriter before the last
write
http://hg.python.org/cpython/rev/27461e6a7763
--
___
Python tracker
Roundup Robot added the comment:
New changeset 99141ab08e21 by Victor Stinner in branch 'default':
Issue #19513: repr(tuple) now uses _PyUnicodeWriter for better performances
http://hg.python.org/cpython/rev/99141ab08e21
--
___
Python tracker
STINNER Victor added the comment:
Thanks Serhiy for your review.
I added a new _PyUnicodeWriter_WriteASCIIString() function to write the
separator (, ) and the suffix (,)).
changeset: 87263:d1ca05428c38
user:Victor Stinner victor.stin...@gmail.com
date:Tue Nov 19 12:54:53
Roundup Robot added the comment:
New changeset fc7ceb001eec by Victor Stinner in branch 'default':
Issue #19513: repr(list) now uses the PyUnicodeWriter API, it is faster than
http://hg.python.org/cpython/rev/fc7ceb001eec
--
nosy: +python-dev
___
STINNER Victor added the comment:
I checked in list_repr_writer-2.patch, thanks Serhiy for your review.
And now the patch for repr(tuple).
Result of bench_tuple_repr.py:
Common platform:
CFLAGS: -Wno-unused-result -Werror=declaration-after-statement -DNDEBUG -g
-fwrapv -O3 -Wall
Changes by STINNER Victor victor.stin...@gmail.com:
Added file: http://bugs.python.org/file32693/bench_tuple_repr.py
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19513
___
Roundup Robot added the comment:
New changeset ead9043f69df by Victor Stinner in branch 'default':
Issue #19513: Simplify list_repr()
http://hg.python.org/cpython/rev/ead9043f69df
--
___
Python tracker rep...@bugs.python.org
STINNER Victor added the comment:
Ok, here is a new version hyper optimized for the final ,) string :-)
--
Added file: http://bugs.python.org/file32696/tuple_repr_writer-2.patch
___
Python tracker rep...@bugs.python.org
Serhiy Storchaka added the comment:
Old version looks better to me (it is simpler and performance of writing final
,) is not worth additional complication).
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19513
STINNER Victor added the comment:
Please open a separate issue for the overallocation factor patch.
Ok, here you have: #19581.
I consider this issue has a dependency of this one, because without a better
overallocation factor on Windows, list_repr_writer-2.patch makes repr(list)
less
Serhiy Storchaka added the comment:
And what will be PyAccu vs PyUnicodeWriter comparison when increase PyAccu
overallocating rate too?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19513
STINNER Victor added the comment:
2013/11/14 Serhiy Storchaka rep...@bugs.python.org:
And what will be PyAccu vs PyUnicodeWriter comparison when increase PyAccu
overallocating rate too?
PyAccu doesn't use a Unicode buffer, but a list of strings.
PyUnicode_Join() is used to compact the list.
STINNER Victor added the comment:
Results on Windows 7.
Common platform:
Python unicode implementation: PEP 393
Timer info: namespace(adjustable=False, implementation='QueryPerformanceCounter(
)', monotonic=True, resolution=1e-08)
Timer: time.perf_counter
Platform: Windows-7-6.1.7601-SP1
STINNER Victor added the comment:
I tried different overallocator factors:
* writer (current factor): 25% (1/4)
* writer50: 50% (1/2)
* writer100: 100% (double the buffer)
-+-++---
Tests | writer |
Serhiy Storchaka added the comment:
You shouldn't cache Py_SIZE(v) because it can be changed during iteration.
Due to benchmark results in issue15381 I afraid this patch will be much slower
on Windows.
--
___
Python tracker rep...@bugs.python.org
STINNER Victor added the comment:
You shouldn't cache Py_SIZE(v) because it can be changed during iteration.
Oops, I fixed the code on my PC, but I generated the patch before fixing this
issue. I agree that Py_SIZE(v) should not be cached.
Due to benchmark results in issue15381 I afraid
STINNER Victor added the comment:
Oops, writer.min_length was not computed correctly :-/ The separator length is
2 characters (, ), not 1.
--
Added file: http://bugs.python.org/file32522/list_repr_writer-2.patch
___
Python tracker
STINNER Victor added the comment:
writer_overallocate_factor.patch: patch for change the overallocation factor
from 25% to 50% on Windows.
See also issues #14716 and #14744 which contains various benchmarks on string
formatting functions.
--
Added file:
Antoine Pitrou added the comment:
Please open a separate issue for the overallocation factor patch.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19513
___
Serhiy Storchaka added the comment:
What about longer elements (10**3 or 10**6 characters)?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19513
___
New submission from STINNER Victor:
PyUnicodeWriter is (a little bit) more efficient than PyAccu to build Unicode
strings.
Attached patch list_repr_writer.patch modify list_repr() to use PyUnicodeWriter.
--
files: list_repr_writer.patch
keywords: patch
messages: 202298
nosy: haypo,
STINNER Victor added the comment:
bench_list_repr.py: benchmark script. It would be interesting to run it on
Windows, performances of realloc() may be different. Result on my Linux box:
Common platform:
Python unicode implementation: PEP 393
Platform:
22 matches
Mail list logo