You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 28, 2025. It is now read-only.
Lazify more work in builtins targets
This PR make some fields in `Target` and `TargetOptions` lazifyable.
This is done in order to reduce the impact of check-cfg which needs to load all the built-ins targets but doesn't need all the fields.
In paticular this PR introduce a `MaybeLazy<T>` struct to support a borrowed, owned and lazy state.
The fields that are changed are:
- `LinkArgs` fields (access to env + allocate): ~54 023 236 ins[^1] -> ~53 478 072 ins
- `CrtObjects` fields (allocate): ~53 478 072 ins -> ~53 127 832 ins
- `llvm_name` field (access to env + allocate): ~53 127 832 ins -> ~53 057 110 ins
This brings around -1 000 000 ins*tructions* and -0.2/0.3ms of less wall-time (with some measurement even having the same minimum wall-time with or without check-cfg) 🎉.
*This PR is also a step further to completely `static`-fying all the build-in targets, if we one day we decide to do it, but that's a separate conversion.*
[^1]: This is the total number of instructions as measured with `cachegrind` for the entire `rustc` invocation on a cargo --lib hello world, variance was really low (<15 000 ins).
In the scale of the check-cfg feature, last time I measured `CheckCfg::fill_well_known` was around ~2.8 millions ins.
r? `@petrochenkov`
0 commit comments