Is there a way to speed up building, especially in development? #3516
-
My build time in development ranges from 5 - 50 secs. Before I had thaw-ui, so I thought it was causing it. But now its only html, and still it has a long build time. I am new to rust, if this is normal esp in leptos please let me know. I hope there is some kind of optimization that is not so messy to implement. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
This will depend a lot on the particulars of your machine, setup, etc. etc. etc. but there is some general advice that can be useful. @benwis my co-maintainer wrote a couple of articles (this one and this one) about experiments with improving compile times in general. More specifically, for incremental build times there will often come a time when you want to start splitting an application into multiples crates, as it scales up. This is because Rust's default unit for compilation is the crate, not the module, so if you change one small part of your application, it needs to recompile the entire crate. Whereas if you split into multiple crates, it only needs to recompile what has changed. If you have a smaller application (too small for multiple crates to make sense) and it's 5-50 seconds in incremental builds, then there may be limited options. (I also just want to share a link to our Discord — I am usually the only one who responds to GitHub Discussions but there are lots of helpful people in the Discord who can share their experiences with questions like this.) |
Beta Was this translation helpful? Give feedback.
-
okay thank you very much |
Beta Was this translation helpful? Give feedback.
This will depend a lot on the particulars of your machine, setup, etc. etc. etc. but there is some general advice that can be useful.
@benwis my co-maintainer wrote a couple of articles (this one and this one) about experiments with improving compile times in general.
More specifically, for incremental build times there will often come a time when you want to start splitting an application into multiples crates, as it scales up. This is because Rust's default unit for compilation is the crate, not the module, so if you change one small part of your application, it needs to recompile the entire crate. Whereas if you split into multiple crates, it only needs to recompile what has changed.
I…