[New-bugs-announce] [issue23206] json.dumps(ensure_ascii=False) is ~10x slower than json.dumps()
INADA Naoki
report at bugs.python.org
Fri Jan 9 14:17:25 CET 2015
New submission from INADA Naoki:
I prefer ensure_ascii=False because it's efficient.
But I notice it is very slower.
On Python 3.4.2:
In [3]: %timeit json.dumps([{'hello': 'world'}]*100)
10000 loops, best of 3: 74.8 µs per loop
In [4]: %timeit json.dumps([{'hello': 'world'}]*100, ensure_ascii=False)
1000 loops, best of 3: 259 µs per loop
On Python HEAD with attached patch:
In [2]: %timeit json.dumps([{'hello': 'world'}]*100)
10000 loops, best of 3: 80.8 µs per loop
In [3]: %timeit json.dumps([{'hello': 'world'}]*100, ensure_ascii=False)
10000 loops, best of 3: 80.4 µs per loop
----------
components: Library (Lib)
files: json-fast-unicode-encode.patch
keywords: patch
messages: 233752
nosy: naoki
priority: normal
severity: normal
status: open
title: json.dumps(ensure_ascii=False) is ~10x slower than json.dumps()
versions: Python 3.5
Added file: http://bugs.python.org/file37653/json-fast-unicode-encode.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23206>
_______________________________________
More information about the New-bugs-announce
mailing list