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

Optimize compile times by replacing the dependency on the cargo crate #69

Open
1 of 3 tasks
anderejd opened this issue Sep 19, 2019 · 4 comments
Open
1 of 3 tasks
Labels
enhancement New feature or request help wanted Extra attention is needed important If you want to contribute, please consider this issue before others.
Milestone

Comments

@anderejd
Copy link
Contributor

anderejd commented Sep 19, 2019

The current compile times are a bit painful, mainly caused by cargo having a huge number dependencies. The obvious solution could be to reduce the number of dependencies of cargo.

Another very nice direction could be to use cargo as a subprocess, no building cargo at all! Can cargo output all the data needed by cargo-geiger? If not, what's missing? Make this list and then open an issue in the cargo repo and ask if a PR adding that missing data export would be welcome. Use cargo_metadata.

Summary

@anderejd anderejd changed the title Optimize compile time Optimize compile times Sep 19, 2019
@anderejd anderejd added enhancement New feature or request help wanted Extra attention is needed labels Sep 19, 2019
@jakubadamw
Copy link
Contributor

This is probably related to #16. 🙂

@anderejd
Copy link
Contributor Author

Yes, that would be an amazing optimization, simply not building cargo :)

@anderejd
Copy link
Contributor Author

anderejd commented Sep 23, 2019

cargo-geiger would likely also need to inject a RUSTC_WRAPPER environment variable and call cargo check instead of implementing cargo::core::compiler::Executor, to retain the "used by build" feature.

@anderejd anderejd added the important If you want to contribute, please consider this issue before others. label Apr 8, 2020
@anderejd anderejd changed the title Optimize compile times Optimize compile times by replacing the dependency on the cargo crate Dec 13, 2020
@jmcconnell26
Copy link
Contributor

Following on from the comment on #16 the remaining usages of the cargo crate are

args.rs:252:    use cargo::core::Verbosity;
args.rs:3:use cargo::core::shell::ColorChoice;
args.rs:4:use cargo::{CliResult, Config};
cli.rs:13:use cargo::core::Workspace;
cli.rs:14:use cargo::util::{self, important_paths, CargoResult};
cli.rs:15:use cargo::Config;
format/print_config.rs:5:use cargo::core::shell::Verbosity;
format/print_config.rs:6:use cargo::util::errors::CliError;
graph.rs:10:use cargo::Config;
graph.rs:7:use cargo::core::Workspace;
graph.rs:8:use cargo::util::interning::InternedString;
graph.rs:9:use cargo::util::CargoResult;
main.rs:22:use cargo::core::shell::Shell;
main.rs:23:use cargo::util::important_paths;
main.rs:24:use cargo::{CliError, CliResult, Config};
mapping/metadata.rs:147:    use cargo::core::dependency::DepKind;
mapping/metadata.rs:148:    use cargo::core::registry::PackageRegistry;
mapping/metadata.rs:149:    use cargo::core::resolver::ResolveOpts;
mapping/metadata.rs:150:    use cargo::core::{Package, PackageId, PackageIdSpec, PackageSet, Resolve, Workspace};
mapping/metadata.rs:151:    use cargo::{ops, CargoResult, Config};
readme.rs:3:use cargo::{CliError, CliResult};
scan/default.rs:17:use cargo::core::compiler::CompileMode;
scan/default.rs:18:use cargo::core::Workspace;
scan/default.rs:19:use cargo::ops::CompileOptions;
scan/default.rs:20:use cargo::{CliError, Config};
scan/default/table.rs:17:use cargo::core::shell::Verbosity;
scan/default/table.rs:18:use cargo::core::Workspace;
scan/default/table.rs:19:use cargo::CliError;
scan/find.rs:11:use cargo::util::CargoResult;
scan/find.rs:12:use cargo::{CliError, Config};
scan/forbid.rs:12:use cargo::{CliError, Config};
scan/forbid/table.rs:14:use cargo::{CliError, Config};
scan.rs:19:use cargo::core::Workspace;
scan.rs:20:use cargo::{CliError, Config};
scan/rs_file/custom_executor.rs:1:use cargo::core::compiler::{CompileMode, Executor, Unit};
scan/rs_file/custom_executor.rs:2:use cargo::core::{PackageId, Target};
scan/rs_file/custom_executor.rs:3:use cargo::util::{CargoResult, ProcessBuilder};
scan/rs_file.rs:10:use cargo::util::{interning::InternedString, paths, CargoResult};
scan/rs_file.rs:11:use cargo::Config;
scan/rs_file.rs:5:use cargo::core::compiler::Executor;
scan/rs_file.rs:6:use cargo::core::manifest::TargetKind;
scan/rs_file.rs:7:use cargo::core::Workspace;
scan/rs_file.rs:8:use cargo::ops;
scan/rs_file.rs:9:use cargo::ops::{CleanOptions, CompileOptions};
tree.rs:86:    use cargo::core::shell::Verbosity;
tree/traversal/dependency_node.rs:127:    use cargo::core::Verbosity;

I have raised #165 to cleanup a trait only used in unit testing, and add a comment relating to cargo dependencies only left in for testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed important If you want to contribute, please consider this issue before others.
Projects
None yet
Development

No branches or pull requests

4 participants