Skip to content
This repository has been archived by the owner on Jun 9, 2022. It is now read-only.

Slow compile times #24

Open
maxcountryman opened this issue Aug 29, 2020 · 3 comments
Open

Slow compile times #24

maxcountryman opened this issue Aug 29, 2020 · 3 comments

Comments

@maxcountryman
Copy link
Contributor

It seems that something is causing excessively slow compile times. For instance, adding a simple println! costs nearly 40 seconds to recompile:

$ cargo run --database-url ...
   Compiling warp-api-starter-template v0.1.0 (/Users/max/Repositories/warp-api-starter-template)
    Finished dev [unoptimized + debuginfo] target(s) in 39.35s
     Running `target/debug/warp-api-starter-template`

Where the only change is:

diff --git a/src/environment/argon.rs b/src/environment/argon.rs
index b70bcd5..ce58cc9 100644
--- a/src/environment/argon.rs
+++ b/src/environment/argon.rs
@@ -15,6 +15,7 @@ impl Argon {
             argon_iterations,
             ..
         } = args;
+        println!("foo");
         Self {
             secret: argon_secret.to_owned(),
             memory_size: argon_memory_size.to_owned(),

This is actually decently faster than other compile times I've observed, which sometimes exceed two minutes (!) but are not significant changes.

Depending on your development style, this may be a showstopper.

@aslamplr
Copy link
Member

Any recommendations on improving the compile times are welcome.

@aslamplr
Copy link
Member

#12 might help in the case of slow compile times. Rust considers crate as a compilation unit and ATM warp-api-starter-template is huge crate and spliting it into multiple dependent crate might allow for better compile times. This is not tested notion for me. I need to try it out and see.

@maxcountryman
Copy link
Contributor Author

@aslamplr I think you're right that breaking things up into component crates could help. At the very least, it should avoid to always recompile everything.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants