-
-
Notifications
You must be signed in to change notification settings - Fork 304
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
Reduce build times for both nannou
and projects created via nannou-new
#178
Comments
SCCACHE might be relevant. I can't get it working on my system though. Installs but I can't get it to register any compile requests. This doesn't look that easy because currently Cargo has no support for linking prebuilt rlibs. On the other hand if we go straight to rustc then we loose all the good things about cargo. I think a major win could be had with sscache because it caches builds locally and on servers. It also integrates with cargo. It might need some improvements to get this to be reliable though. Another option is to build all dependancies seperatly with cargo then combine them with our own tool. Not sure how hard this would be but it would allow us to still take advantage of cargo. Todo
|
sccache__Link Issues
Solutions
|
This sounds really promising!
So the
Ahh, so does disabling incremental compilation help with this? I guess this is not really a feasible solution in the long run though as incremental compilation gives such massive wins when working on new projects, especially when continually recompiling and iterating, etc. We'd be trading in one time-sink for another. Regarding the issue you linked:
I think this is a pretty potent point, and would also mean we can avoid having to add extra 3rd-party magic. I guess sccache will have to do though for now if we can't find any promising WIPs in cargo itself!
Nannou "Getting Started"One thing that I'd like for us to seriously consider first is how this will affect the "Getting Started" process. Although this will speed up the |
Ok so I ran that branch with the changes to hash with nannou-new and still got zero cache hits It's something in this function that is changing between different nannou-new builds. I will compare two runs and try to find the difference Ok so I found these differences in the hash for two different nannou-new
VS
Looks like the job server changes from 38 to 39 Also this directory changes /Users/tomgowan/rust/ksbdksbdkfdsjk/target/release/deps:/Users/tomgowan/.rustup/toolchains/nightly-x86_64-apple-darwin/lib:/Users/tomgowan/.rustup/toolchains/nightly-x86_64-apple-darwin/lib Link to job server docs Maybe this is fixed in a future version. The next step will be to merge the branch im using with the latest sccache master and see if that get's the same hash |
Looks like a lot of these issues have been solved in updates to I want to try and cash bins because even if it doesn't work all the time it could be a huge time saver in the times it does work. |
I use a single project with a set of See also my comment on #387, allowing nannou-new to use lld should speed up initial as well as incremental compiles. It does require that the user install lld though. |
After running a few workshops, we've run into a couple of serious bottlenecks for new users getting started with nannou.
Note: This issue does not refer to automation of the "getting started" process, just the build times themselves. I'll open a separate issue for this.
1. Initial build time of
nannou
After installing the rust toolchain, the first step is to clone the nannou repo and build it in order to run the examples. For users with relatively new machines, this takes around 3-5 minutes from scratch, which is already a long time in itself, however for users with older machines it can take up to 20mins (maybe longer)? This is a serious time-sink for workshops where we just want to get users running the examples and playing as quickly as possible.
Possible Solution
Ideally, we'd distribute pre-built versions of the library that are hashed against:
Ideally, if a build does not exist with this hash, or if some sort of unexpected error occurs when attempting to link this crate, the build process would then fall back to the default cargo procedure of building from source.
An even more awesome solution would be if cargo itself decided to start shipping pre-built binaries, however this would obviously massively increase the cost due to requiring time and access to all platforms necessary for pre-building and hashing the binaries (whereas currently they just need to store and serve source code).
Having a system for building nannou for multiple platforms, storing and serving these binaries is also something that we will also have to solve, though is obviously much more achievable than doing so for all 10k+ crates or whatever the number is now currently on cargo.
Related issues:
2. Build times of new sketches/apps generated via
nannou-new
Cargo currently requires re-building the entire
nannou
package for each newly created "sketch"/"app" generated via thenannou-new
tool. This is obviously a massive time-sink for all the reasons described above, though is particularly troublesome for a couple reasons:nannou-new
is to allow the user to get started with sketching an idea as quickly and efficiently as possible. Waiting 20 minutes is easily enough time to forget about your original idea plus 20 others in the time it just takes to compile nannou again.Possible Solution
This one could obviously be cleanly solved by the same solution as above (serving a pre-built crate). However, this problem could also be solved by re-using pre-built
nannou
crates that the user themself have already built. E.g. there should be no need to re-buildnannou
version X if a built version already exists on the user's system that was built using the same version of rustc and cargo. This is perhaps something we could do ourselves within thenannou-new
call - e.g. search the user's system for an existing version and copy it to thetarget
dependencies directory. I'm sure there might be other steps involved to do this properly and validly, but you get the gist.Ideally this would also be a feature of cargo itself - allowing to share dependencies between unrelated crates.
Related issues:
cc @freesig just thought I'd get all my thoughts down on this in case it helps! Would be such a massive win to get these solved.
The text was updated successfully, but these errors were encountered: