New submission from Alexander Belopolsky <belopol...@users.sourceforge.net>:

$ ./python.exe -m timeit "b'x'.decode('latin1')"
100000 loops, best of 3: 2.57 usec per loop
$ ./python.exe -m timeit "b'x'.decode('latin-1')"
1000000 loops, best of 3: 0.336 usec per loop

The reason for this behavior is that 'latin-1' is short-circuited in C code 
while 'latin1' has to be looked up in aliases.py.  Attached patch fixes this 
issue.

----------
files: latin1.diff
keywords: patch
messages: 129227
nosy: belopolsky, lemburg
priority: normal
severity: normal
status: open
title: b'x'.decode('latin1') is much slower than b'x'.decode('latin-1')
type: performance
Added file: http://bugs.python.org/file20871/latin1.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11303>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to