Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue15612] Rewriter StringIO to use the _PyUnicodeWriter API

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Aug 9, 2012, 7:30 PM

Post #1 of 3 (57 views)
Permalink
[issue15612] Rewriter StringIO to use the _PyUnicodeWriter API

New submission from STINNER Victor:

Attached patch rewrites the C implementation of StringIO to use the _PyUnicodeWriter API instead of the PyAccu API. It provides better performance when writing non-ASCII strings.

The patch adds new functions:

- _PyUnicodeWriter_Truncate()
- _PyUnicodeWriter_WriteStrAt()
- _PyUnicodeWriter_GetValue()

----------
components: IO, Unicode
files: stringio_unicode_writer.patch
keywords: patch
messages: 167850
nosy: ezio.melotti, haypo, pitrou
priority: normal
severity: normal
status: open
title: Rewriter StringIO to use the _PyUnicodeWriter API
versions: Python 3.4
Added file: http://bugs.python.org/file26752/stringio_unicode_writer.patch

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15612>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 9, 2012, 7:32 PM

Post #2 of 3 (54 views)
Permalink
[issue15612] Rewriter StringIO to use the _PyUnicodeWriter API [In reply to]

STINNER Victor added the comment:

Results of my micro benchmark. Use attached bench_stringio.py with benchmark.py:
https://bitbucket.org/haypo/misc/src/tip/python/benchmark.py

Command:
./python benchmark.py script bench_stringio.py

----

Common platform:
CPU model: Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
Python unicode implementation: PEP 393
Platform: Linux-3.4.4-4.fc16.x86_64-x86_64-with-fedora-16-Verne
Bits: int=32, long=64, long long=64, pointer=64
CFLAGS: -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes

Platform of campaign pyaccu:
Date: 2012-08-10 04:24:53
SCM: hg revision=aaa68dce117e tag=tip branch=default date="2012-08-09 21:38 +0200"
Python version: 3.3.0b1 (default:aaa68dce117e, Aug 10 2012, 04:24:19) [GCC 4.6.3 20120306 (Red Hat 4.6.3-2)]

Platform of campaign writer:
Date: 2012-08-10 04:23:21
SCM: hg revision=aaa68dce117e+ tag=tip branch=default date="2012-08-09 21:38 +0200"
Python version: 3.3.0b1 (default:aaa68dce117e+, Aug 10 2012, 04:18:39) [GCC 4.6.3 20120306 (Red Hat 4.6.3-2)]

--------------------------------------+-------------+---------------
Tests | pyaccu | writer
--------------------------------------+-------------+---------------
writer ascii | 30.4 ms (*) | 30.4 ms
writer reader ascii | 37.1 ms (*) | 37 ms
writer latin1 | 31.5 ms (*) | 30.6 ms
writer reader latin1 | 38.6 ms (*) | 37.4 ms
writer bmp | 31.8 ms (*) | 29.7 ms (-7%)
writer reader bmp | 40.8 ms (*) | 36.6 ms (-10%)
writer non-bmp | 33.4 ms (*) | 30.2 ms (-10%)
writer reader non-bmp | 40.9 ms (*) | 36.7 ms (-10%)
writer long lines ascii | 7.96 ms (*) | 7.34 ms (-8%)
writer-reader long lines ascii | 8.16 ms (*) | 7.39 ms (-9%)
writer long lines latin1 | 8.01 ms (*) | 7.4 ms (-8%)
writer-reader long lines latin1 | 8.05 ms (*) | 7.4 ms (-8%)
writer long lines bmp | 14 ms (*) | 9.42 ms (-33%)
writer-reader long lines bmp | 14.2 ms (*) | 9.45 ms (-34%)
writer long lines non-bmp | 13.9 ms (*) | 9.62 ms (-31%)
writer-reader long lines non-bmp | 14.3 ms (*) | 9.63 ms (-32%)
writer very long lines ascii | 7.96 ms (*) | 7.36 ms (-7%)
writer-reader very long lines ascii | 8.05 ms (*) | 7.37 ms (-8%)
writer very long lines latin1 | 7.98 ms (*) | 7.33 ms (-8%)
writer-reader very long lines latin1 | 8 ms (*) | 7.39 ms (-8%)
writer very long lines bmp | 14.1 ms (*) | 9.34 ms (-34%)
writer-reader very long lines bmp | 14.2 ms (*) | 9.4 ms (-34%)
writer very long lines non-bmp | 13.9 ms (*) | 9.5 ms (-32%)
writer-reader very long lines non-bmp | 14 ms (*) | 9.61 ms (-31%)
reader ascii | 6.48 ms (*) | 6.22 ms
reader latin1 | 6.59 ms (*) | 6.57 ms
reader bmp | 7.22 ms (*) | 6.9 ms
reader non-bmp | 7.65 ms (*) | 7.31 ms
--------------------------------------+-------------+---------------
Total | 489 ms (*) | 431 ms (-12%)
--------------------------------------+-------------+---------------

----------
Added file: http://bugs.python.org/file26753/bench_stringio.py

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15612>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 9, 2012, 7:33 PM

Post #3 of 3 (54 views)
Permalink
[issue15612] Rewriter StringIO to use the _PyUnicodeWriter API [In reply to]

Changes by STINNER Victor <victor.stinner [at] gmail>:


----------
type: -> performance

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15612>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.