Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-use old indent in json.loads() #118299

Closed
nineteendo opened this issue Apr 25, 2024 · 3 comments
Closed

Re-use old indent in json.loads() #118299

nineteendo opened this issue Apr 25, 2024 · 3 comments
Labels
type-feature A feature request or enhancement

Comments

@nineteendo
Copy link
Contributor

nineteendo commented Apr 25, 2024

Feature or enhancement

Proposal:

Currently the indent is generated from scratch for each depth:

_current_indent_level += 1
newline_indent = '\n' + _indent * _current_indent_level

We can easily re-use the old indent:

newline_indent = old_newline_indent + _indent

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

@nineteendo nineteendo added the type-feature A feature request or enhancement label Apr 25, 2024
@serhiy-storchaka
Copy link
Member

Could you show any benchmark results?

@nineteendo
Copy link
Contributor Author

See the pull request: #118300 (comment)

@nineteendo
Copy link
Contributor Author

Do we close this? Or did you mean I could leave it at concatenation?

@nineteendo nineteendo closed this as not planned Won't fix, can't repro, duplicate, stale May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-feature A feature request or enhancement
Projects
Status: Done
Development

No branches or pull requests

2 participants