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: don't prettify json when not necessary #24

Merged
merged 2 commits into from
Nov 14, 2023
Merged

Conversation

DaniPopes
Copy link
Member

Closes #23

Building foundry testdata:

pretty
3,55s user 1,54s system 300% cpu 1,698 total

no pretty
2,86s user 1,78s system 275% cpu 1,682 total

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pedantic nit

serde_json::from_str(&contents).map_err(Into::into)
// See: https://github.com/serde-rs/json/issues/160
let file = fs::File::open(path).map_err(|err| SolcError::io(err, path))?;
let bytes = unsafe { memmap2::Mmap::map(&file).map_err(|err| SolcError::io(err, path))? };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs safety

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SAFETY: not safe, but whatever

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair enough :D

@DaniPopes DaniPopes merged commit b4a21cd into main Nov 14, 2023
38 checks passed
@DaniPopes DaniPopes deleted the dani/better-jsoning branch November 14, 2023 12:22
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.

Don't prettify cache JSON
2 participants