[issue16334] Faster unicode-escape and raw-unicode-escape codecs

2016-09-07 Thread STINNER Victor
STINNER Victor added the comment: Feel free to document the change. It's not my patch, it's yours :-) -- ___ Python tracker ___

[issue16334] Faster unicode-escape and raw-unicode-escape codecs

2016-09-07 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thanks Victor! I benchmarked your patch. There is no regression in comparison with my patch. In few cases your patch is even faster! UnpatchedPatch v.4Patch v.5 148 (+76%) 235 (+11%) 260decode unicode-escape 'A'*1 197 (+30%) 257

[issue16334] Faster unicode-escape and raw-unicode-escape codecs

2016-09-06 Thread STINNER Victor
STINNER Victor added the comment: Since it's almost the 3.6 beta 1, I chose to push the change right now. I'm sure that it's faster, I trust your benchmarks ;-) Thanks Serhiy for this nice enhancement. > > * Rename WRITECHAR macro to WRITE_ASCII_CHAR() > This is not correct name. This macro

[issue16334] Faster unicode-escape and raw-unicode-escape codecs

2016-09-06 Thread Roundup Robot
Roundup Robot added the comment: New changeset ad5a28ace615 by Victor Stinner in branch 'default': Optimize unicode_escape and raw_unicode_escape https://hg.python.org/cpython/rev/ad5a28ace615 -- nosy: +python-dev ___ Python tracker

[issue16334] Faster unicode-escape and raw-unicode-escape codecs

2016-09-02 Thread STINNER Victor
STINNER Victor added the comment: > Did you benchmark this change? I afraid that this inflates execution code > size and can have negative impact on the performance. I consider that readability (maintainability) matters more than such micro optimization. --

[issue16334] Faster unicode-escape and raw-unicode-escape codecs

2016-09-02 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > Unicode escape encodecs were modified by the issue #25353 to use the > _PyBytesWriter API. Sadly, I didn't benchmark my change before pushing it > :-/ You can benchmark it now by checking out revisions with your patch and just before. But AFAIK the

[issue16334] Faster unicode-escape and raw-unicode-escape codecs

2016-09-02 Thread STINNER Victor
STINNER Victor added the comment: I rebased faster_unicode_escape_4.patch and made tiny changes: * Rename WRITECHAR macro to WRITE_ASCII_CHAR() * Add WRITE_CHAR() macro to avoid "goto writechar;" * Drop the "store" label: use WRITE_CHAR() macro instead, expect that getcode() only returns valid

[issue16334] Faster unicode-escape and raw-unicode-escape codecs

2016-09-02 Thread STINNER Victor
STINNER Victor added the comment: Unicode escape encodecs were modified by the issue #25353 to use the _PyBytesWriter API. Sadly, I didn't benchmark my change before pushing it :-/ Your patch basically reverts my change. > Py3.2Py3.3Py3.6Py3.6+patch > 195 (+136%) 109

[issue16334] Faster unicode-escape and raw-unicode-escape codecs

2016-06-19 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Victor's patch harvested most fruits, but there is a place for further optimization. Benchmark results for new patch: Py3.2Py3.3Py3.6Py3.6+patch 451 (-47%) 77 (+209%) 140 (+70%) 238decode unicode-escape 'A'*1 269

[issue16334] Faster unicode-escape and raw-unicode-escape codecs

2013-04-02 Thread STINNER Victor
STINNER Victor added the comment: unicode-escape and raw-unicode-escape decoders now use the PyUnicodeWriter API. Can you please compare performances of your patch to PyUnicodeWriter API? Decoders overallocate the buffer. According to a comment in the decoder, overallocating is never needed

[issue16334] Faster unicode-escape and raw-unicode-escape codecs

2012-10-26 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: The proposed patch optimizes unicode-escape and raw-unicode-escape codecs. Coders still slower than in 3.2, but much faster than in 3.3. Further speedup is possible with the use of stringlib, but I think that this is enough. The code unified and