My project has ~1700 lines of Rust, ends up pulling in ~700 dependencies and changing one line in main.rs takes about ~20 seconds for the debug compile to finish (on a 5950X CPU). Fresh build takes about 1m30s but that only happens on CI, so not really a problem day-to-day for me. Full CI build on Codeberg/Woodpecker takes around 5 minutes from push to release created, but that's including other things too.
I have no experience with Rust. Having 0.4 dependencies per line (so every 3 lines you are dependent on a 3rd-party) sounds very extreme. Can you elaborate a bit what those dependencies are (like many std libs?)?
My project have ~30 dependencies defined for various features in the client. The rest are transitive.
Here is the output of cargo tree for your leisure: https://pastebin.com/aep1bX4v
A quick scan of cargo tree seems to indicate most of them comes from tauri and actix projects.
Edit: oh, and also tantivy (a search engine) ends up pulling in ~300 dependencies which is a pretty big chunk of the total
- An electron-like framework
- A web framework
- Multiple HTTP clients
- An HTML parser
- An image editor
- A search engine
Some potential dependency savings I noticed:
How come you pull in both isahc and reqwest? On the surface, don't they fill the same role? Similar for rustls and openssl.
If you upgrade your readability dependency, you will only pull in reqwest once instead of twice. Might be useful to run `cargo tree -d`.
I'm not familiar with savefile? What does that get you over serde_json which you also pull in?
This isn't like C++ where a single dependency is a huge project. Some crates are literally just trait (interface) definitions.
- denoland/deno (nodejs-like runtime) - 1550
- alacritty/alacritty (Terminal) - 303
- sharkdp/bat (`cat` clone) - 249
- meilisearch/meilisearch (search engine) - 1128
- starship/starship (command line prompt) - 427
- swc-project/swc (JS/TS compiler) - 1869
- AppFlowy-IO/AppFlowy (Notion clone) - 1146
- yewstack/yew (Rust/WASM web framework) - 942
- rustdesk/rustdesk (remote desktop) - 648
- nushell/nushell (shell) - 858
- ogham/exa (`ls` alternative) - 61
So yeah, seems even things as basic as a `cat` replacement ends up with 249 dependencies. Lowest amount of dependencies is a `ls` alternative, which ends up with 62 dependencies.
Incremental builds are unlikely to benefit from multiple cores. I have a 5900x Desktop and recently bought a Laptop with 12700H. For some incremental builds, I'm getting the same performance. The Desktop Ryzen shines with full multiple builds (where the laptop gets hot and has to sabotage itself); or with running multiple programs without noticeable performance impact.
But then I come from a dynamic application development background (mostly Clojure), so maybe I do have a pretty unfair view on how fast I should be able to make a change and see the effects (sub second is the usual wait time in Clojure land).