-
-
Notifications
You must be signed in to change notification settings - Fork 439
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
Deps: prefer sub-crates of futures
#935
Conversation
futures
futures
type ConfigCallback = | ||
dyn Fn(&mut ConnectConfiguration, &str) -> Result<(), ErrorStack> + Sync + Send; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clippy complains if we don't use a type alias here. To be fair, it is a pretty lengthy type declaration. 😅
How much does this improve build times? |
System InformationThe following measurements have been tested on a laptop with the following specs:
I then ran the following commands and recorded the (cold) compilation times reported by Cargo: cargo clean # clean up old artifacts
cargo build -p postgres # only compile `postgres` on debug
cargo clean # clean up old artifacts
cargo build -p postgres -r # only compile `postgres` on release Native WindowsOn native Windows, the build times improved ever so slightly on debug builds. For the release builds, however, I must say that the improvements may still be within the realm of noise. However, there is an improvement in the number of crates needed to compile. Before the PR, a Windows build required 105 crates. Now, it only requires 103 crates. This is likely due to the absence of the
LinuxI also measured on an Ubuntu 22.04.1 build (via Windows Subsystem for Linux). There is also a slight improvement on debug builds. Release builds remained more or less the same. Regarding the number of crates compiled, the Linux side had two fewer crates to compile (from 101 to 99). This difference is consistent with native Windows. Again, this is likely due to the absence of the
ConclusionThere is a slight improvement in cold debug builds. In both Windows and Linux (via WSL), we reduced the number of compiled crates by two. For projects with larger dependency trees, removing |
This PR attempts to shorten compilation times by preferring dependencies on the sub-crates of
futures
rather than the entirefutures
crate itself. The changes I've made practically slim down the default features (offutures
) to just two crates:futures-util
andfutures-channel
.To make CI pass, I also needed to fix some Clippy warnings. Most of them were mechanical changes.
With that said, I don't expect any breaking changes. At the very least, there should be a slight improvement in compilation times. Thanks! 🎉