[New-bugs-announce] [issue25267] Optimize UTF-8 encoder with error handlers

STINNER Victor report at bugs.python.org
Tue Sep 29 13:30:34 CEST 2015


New submission from STINNER Victor:

Attached patch optimizes the UTF-8 encoder for error handlers: ignore, replace, surrogateescape, surrogatepass. It is based on the patch  faster_surrogates_hadling.patch written by Serhiy Storchaka in the issue #24870.

It also modifies unicode_encode_ucs1() to use memset() for the replace error handler. It should be faster for long sequences of unencodable characters, but it may be slower for short sequences of unencodable characters.

The patch adds new unit tests and fix unit tests to ensure that utf-8-sig codec is also well tested.

TODO: write a benchmark.

See also the issue #25227 which optimized ASCII and latin1 encoders with the surrogateescape error handlers.

----------
components: Unicode
files: utf8_encoder_errors.patch
keywords: patch
messages: 251845
nosy: ezio.melotti, haypo, naoki, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Optimize UTF-8 encoder with error handlers
type: performance
versions: Python 3.6
Added file: http://bugs.python.org/file40619/utf8_encoder_errors.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25267>
_______________________________________


More information about the New-bugs-announce mailing list