Skip to content
This repository was archived by the owner on Apr 20, 2026. It is now read-only.

perf: don't prettify json when not necessary#24

Merged
DaniPopes merged 2 commits intomainfrom
dani/better-jsoning
Nov 14, 2023
Merged

perf: don't prettify json when not necessary#24
DaniPopes merged 2 commits intomainfrom
dani/better-jsoning

Conversation

@DaniPopes
Copy link
Copy Markdown
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

@DaniPopes DaniPopes requested a review from Evalir as a code owner November 14, 2023 02:31
Copy link
Copy Markdown
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

Comment thread src/utils.rs
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@DaniPopes DaniPopes deleted the dani/better-jsoning branch November 14, 2023 12:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Don't prettify cache JSON

2 participants