]> granicus.if.org Git - python/commit
bpo-37587: Make json.loads faster for long strings (GH-14752)
authorMarco Paolini <mpaolini@users.noreply.github.com>
Tue, 30 Jul 2019 14:16:34 +0000 (15:16 +0100)
committerNick Coghlan <ncoghlan@gmail.com>
Tue, 30 Jul 2019 14:16:34 +0000 (00:16 +1000)
commit8a758f5b99c5fc3fd32edeac049d7d4a4b7cc163
treed56c7f01cdf44565a93f5a3373fb2992fccaf5ee
parent9211e2fd81fe1db6f73ded70752b144cc9691ab6
bpo-37587: Make json.loads faster for long strings (GH-14752)

When scanning the string, most characters are valid, so
checking for invalid characters first means never needing
to check the value of strict on valid strings, and only
needing to check it on invalid characters when doing
non-strict parsing of invalid strings.

This provides a measurable reduction in per-character
processing time (~11% in the pre-merge patch testing).
Misc/NEWS.d/next/Library/2019-07-13-16-02-48.bpo-37587.fd-1aF.rst [new file with mode: 0644]
Modules/_json.c