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

Avoid loading files for cached format results #8134

Merged
merged 1 commit into from Oct 23, 2023

Conversation

MichaReiser
Copy link
Member

@MichaReiser MichaReiser commented Oct 23, 2023

Summary

Avoid loading the content of cached files during formatting

Test Plan

Closes #8132

Performance

This reduces the runtime for a hot formatting on airflow from ~105ms to ~90ms

Thanks @konstin for the find.

@MichaReiser
Copy link
Member Author

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@MichaReiser MichaReiser force-pushed the format-cache-avoid-reading-files branch from 8a1e37f to 2ad7124 Compare October 23, 2023 10:03
@MichaReiser MichaReiser added the performance Potential performance improvement label Oct 23, 2023
@MichaReiser MichaReiser marked this pull request as ready for review October 23, 2023 10:11
Copy link
Member

@konstin konstin left a comment

Choose a reason for hiding this comment

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

thanks

Comment on lines -428 to +434
Diff(SourceKind),
Diff {
unformatted: SourceKind,
formatted: SourceKind,
},
/// The file was unchanged, as the formatted contents matched the existing contents.
Unchanged,

/// Skipped formatting because its an unformatted file format
Skipped,
Copy link
Member

Choose a reason for hiding this comment

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

This was easier than i expected

@github-actions
Copy link

PR Check Results

Ecosystem

✅ ecosystem check detected no changes.

@MichaReiser MichaReiser merged commit 6199590 into main Oct 23, 2023
16 checks passed
@MichaReiser MichaReiser deleted the format-cache-avoid-reading-files branch October 23, 2023 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Potential performance improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't read source files in formatter when there is a cache hit
2 participants