-
Notifications
You must be signed in to change notification settings - Fork 619
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This removes `num-rational` as a dependency. As it turns out, `num-rational`, based on which features are active, can very easily end up on the critical path during compilation, meaning that it is the crate that determines how long it takes to compile the `image` crate. This is because `cargo` can parallelize compilation of many crates, but crates with a long dependency chains (rather than wide), are the ones that in the end determine the compilation speed. This is one of the learnings of the `serde` drama, where it has been noticed that allowing `serde` and `serde_derive` to compile in parallel reduces its long dependency chain, resulting in faster compile times. This introduces the same kind of optimization here, where for all the following features, `num-rational` turns out to be the longest dependency chain: `png,jpeg,gif,bmp,ico,pnm,tga,tiff,webp,hdr,dxt,dds,farbfeld,qoi` The critical path is the following: `autocfg` → `num-traits` compile build.rs → `num-traits` run build.rs → `num-traits` → `num-integer` → `num-rational` → `image` As it turns out, the only thing really used in `num-rational` is `Ratio`, which can be easily replicated. This cuts out both `num-integer` and `num-rational` cutting compile times by around 0.5 seconds on a debug build.
- Loading branch information
Showing
4 changed files
with
69 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters