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

Mailing List Archive: Python: Bugs
[issue15596] pickle: Faster serialization of Unicode strings
 

Index | Next | Previous | View Flat


report at bugs

Aug 8, 2012, 3:38 PM


Views: 87
Permalink
[issue15596] pickle: Faster serialization of Unicode strings

New submission from STINNER Victor:

Serialization of Unicode strings in the pickle module is suboptimal, especially for long strings.

Attached patch optimize the serialization thanks to new properties of Unicode strings (PEP 393):

* text (protocol 0): avoid any temporary buffer if the string is an ASCII or latin1 string without "\\" or "\n" character; otherwise use a small buffer of 64 KB (instead of two buffer)
* binary (protocol 1, 2): avoid any temporary buffer if string is an ASCII string or if the string is already available encoded as UTF-8

The current code for protocol 0 uses raw_unicode_escape() which is really suboptimal: it uses a first buffer to write the escape string, and then a new temporary buffer to store the buffer with the right size (instead of just calling _PyBytes_Resize).

----------
components: Library (Lib)
files: pickle_unicode.patch
keywords: patch
messages: 167730
nosy: alexandre.vassalotti, haypo, pitrou
priority: normal
severity: normal
status: open
title: pickle: Faster serialization of Unicode strings
type: performance
versions: Python 3.4
Added file: http://bugs.python.org/file26730/pickle_unicode.patch

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

Subject User Time
[issue15596] pickle: Faster serialization of Unicode strings report at bugs Aug 8, 2012, 3:38 PM
    [issue15596] pickle: Faster serialization of Unicode strings report at bugs Aug 8, 2012, 3:41 PM
    [issue15596] pickle: Faster serialization of Unicode strings report at bugs Aug 9, 2012, 10:10 AM
    [issue15596] pickle: Faster serialization of Unicode strings report at bugs Aug 9, 2012, 2:49 PM
    [issue15596] pickle: Faster serialization of Unicode strings report at bugs Aug 9, 2012, 3:03 PM
    [issue15596] pickle: Faster serialization of Unicode strings report at bugs Aug 9, 2012, 3:08 PM
    [issue15596] pickle: Faster serialization of Unicode strings report at bugs Aug 9, 2012, 3:08 PM
    [issue15596] pickle: Faster serialization of Unicode strings report at bugs Aug 10, 2012, 7:16 PM

  Index | Next | Previous | View Flat
 
 


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