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

perf: read json to memory before parsing #991

Merged
merged 1 commit into from
Dec 19, 2024

Conversation

wolfv
Copy link
Contributor

@wolfv wolfv commented Dec 19, 2024

I saw a lot of file system activity on macOS related to reading package cache files.

The way we were reading them was not optimal. std::fs::read_to_string does a better job: it looks at the file, checks the size, and uses the size as a hint to first allocate the string and then allocate the buffer for the reading. So I hope this will improve this a bit.

Screenshot 2024-12-19 at 09 41 39

@baszalmstra
Copy link
Collaborator

Yes from_reader is notoriously slow! 👍

@baszalmstra baszalmstra changed the title make reading json files faster by using bigger buffers perf: read json to memory before parsing Dec 19, 2024
@baszalmstra baszalmstra merged commit 48bda63 into conda:main Dec 19, 2024
14 of 16 checks passed
@baszalmstra baszalmstra mentioned this pull request Dec 19, 2024
@wolfv wolfv deleted the improve-package-file branch December 19, 2024 08:59
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