Skip to content

[3.8] bpo-37587: Make json.loads faster for long strings (GH-14752)#15022

Merged
miss-islington merged 1 commit into
python:3.8from
miss-islington:backport-8a758f5-3.8
Jul 30, 2019
Merged

[3.8] bpo-37587: Make json.loads faster for long strings (GH-14752)#15022
miss-islington merged 1 commit into
python:3.8from
miss-islington:backport-8a758f5-3.8

Conversation

@miss-islington

@miss-islington miss-islington commented Jul 30, 2019

Copy link
Copy Markdown
Contributor

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).
(cherry picked from commit 8a758f5)

Co-authored-by: Marco Paolini mpaolini@users.noreply.github.com

https://bugs.python.org/issue37587

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).
(cherry picked from commit 8a758f5)

Co-authored-by: Marco Paolini <mpaolini@users.noreply.github.com>
@miss-islington

Copy link
Copy Markdown
Contributor Author

@mpaolini and @ncoghlan: Status check is done, and it's a success ✅ .

@miss-islington miss-islington merged commit 9265a87 into python:3.8 Jul 30, 2019
@miss-islington miss-islington deleted the backport-8a758f5-3.8 branch July 30, 2019 14:37
@miss-islington

Copy link
Copy Markdown
Contributor Author

@mpaolini and @ncoghlan: Status check is done, and it's a success ✅ .

2 similar comments
@miss-islington

Copy link
Copy Markdown
Contributor Author

@mpaolini and @ncoghlan: Status check is done, and it's a success ✅ .

@miss-islington

Copy link
Copy Markdown
Contributor Author

@mpaolini and @ncoghlan: Status check is done, and it's a success ✅ .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants