You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 1, 2022. It is now read-only.
The clap crate (not counting dependencies) takes about 11 seconds to compile. All dependencies put together take roughly the same amount of time.
I have a few thoughts on how to improve the situation. Generally, compile time wins these days are accomplished through "compile less code", hence:
Feature-gate #[derive(Clone, Copy, Eq...]. The features should probably be fine-grained, like impl-traits-eq enables Eq + PartialEq. Plus the "enable everything" impl-traits feature that implies all the traits.
Avoid using derives and use some sort of STRUCT! macro as shown here. It turns out that even built-in derives have impact on compilation time when you have lots of them, and every struct here has #[derive(Debug)].
Optimize proc-macro-error (drop syn-mid dep). I had already done that but decided to play around a bit more and then forgot about it. Oops.
Make clap modular so developers could choose exactly the set of features they need and avoid compile the others. I'll crate a separate issue a bit later.
The list is probably not exhaustive...
The text was updated successfully, but these errors were encountered:
Comment by CreepySkeleton Friday Jul 31, 2020 at 12:24 GMT
Sure, you can try, but keep in mind that the real goal is to reduce compilation time. If the measurements will show no real difference (at least half second, everything below the threshold is noise), I will say "well we tried" and move on to other ideas.
Comment by CreepySkeleton Friday Jul 31, 2020 at 14:23 GMT
The invocation was
cargo clean # make sure the we build from scratch
cargo +nightly build -Z timings -p clap:3.0.0-beta.1 --features "yaml unstable"
This will create cargo-timing-<HASH>.html file that you can open in your web browser and see the adorable stats you were so excited about :) Then I uploaded the raw html on gist.github.com and linked it through gistpreview.github.io so you see the rendered version instead of raw HTML guts.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Issue by CreepySkeleton
Tuesday Jul 28, 2020 at 11:47 GMT
Originally opened as clap-rs/clap#2037
All features
No features
The
clap
crate (not counting dependencies) takes about 11 seconds to compile. All dependencies put together take roughly the same amount of time.I have a few thoughts on how to improve the situation. Generally, compile time wins these days are accomplished through "compile less code", hence:
#[derive(Clone, Copy, Eq...]
. The features should probably be fine-grained, likeimpl-traits-eq
enablesEq + PartialEq
. Plus the "enable everything"impl-traits
feature that implies all the traits.STRUCT!
macro as shown here. It turns out that even built-in derives have impact on compilation time when you have lots of them, and every struct here has#[derive(Debug)]
.proc-macro-error
(dropsyn-mid
dep). I had already done that but decided to play around a bit more and then forgot about it. Oops.The list is probably not exhaustive...
The text was updated successfully, but these errors were encountered: