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

Reduce size of JSON data in Mypy cache #14808

Merged
merged 1 commit into from
Mar 1, 2023

Conversation

dosisod
Copy link
Contributor

@dosisod dosisod commented Mar 1, 2023

By default, Python outputs spaces after commas and colons when dumping JSON data. This is normally fine, but when exporting large amounts of JSON (such as cache info) it is more space efficient to export JSON without whitespaces. To do this, simply pass separators=(",", ":") to json.dumps().

Although the space savings aren't massive, they do reduce the size of the cache folder by a couple of megabytes:

Method Size
Current 31.2MB
This PR 29.3MB

For comparison, the size of the cache folder with the --sqlite-cache option is about 27.5MB.

By default, Python outputs spaces after commas and colons when dumping JSON
data. This is normally fine, but when exporting large amounts of JSON (such as
cache info) it is more space efficient to export JSON without whitespaces. To
do this, simply pass `separators=(",", ":")` to `json.dumps()`.

Although the space savings aren't massive, they do reduce the size of the cache
folder by a couple of megabytes:

| Method  | Size   |
|---------|--------|
| Current | 31.2MB |
| This PR | 29.3MB |

For comparison, the size of the cache folder with the `--sqlite-cache` option
is about 27.5MB.
@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2023

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@JelleZijlstra JelleZijlstra merged commit 9393c22 into python:master Mar 1, 2023
@dosisod dosisod deleted the minify-json-cache branch March 1, 2023 20:30
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.

2 participants