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

generator: Replace super::super::* with narrower imports. #989

Merged
merged 2 commits into from
Mar 24, 2025

Conversation

TechPizzaDev
Copy link
Contributor

A mod importing itself hits a slow path in rustc at compute_effective_visibilities since cyclic imports are handled specially. This improvement also happens to greatly reduce the size of .rmeta files.

Self-profile of release build for ash on AMD Ryzen 7 7700X:

Version rmeta Size CPU Time Real Time
Before PR ~68 MiB 15.3s 23.3s
After PR ~40 MiB 12.6s 23.3s
Diff -29 MiB -2.6s 0s

Elapsed real time didn't change likely because of build pipelining. I imagine weaker machines could benefit more from this. This should in general help many projects since ash is used in wgpu.

A `mod` importing itself hits a slow path in rustc at `compute_effective_visibilities` since cyclic imports are handled specially. This improvement also happens to greatly reduce the size of `.rmeta` files.
Copy link
Collaborator

@Ralith Ralith left a comment

Choose a reason for hiding this comment

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

Nice, thanks! Even if wall time doesn't change, reduced CPU time should mean more CPU for other parts of downstream builds, I think. I wonder if using fully qualified names would help even more.

@TechPizzaDev
Copy link
Contributor Author

It will likely help but with diminishing returns. compute_effective_visibilities seems to take milliseconds on other big crates I've profiled, and it took roughly 2s before and 500ms after this PR (since importing create::vk::* is still thousands of imports...)

@Ralith Ralith merged commit 76baaaf into ash-rs:master Mar 24, 2025
7 of 10 checks passed
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