oxidecomputer / oxidecomputer/humility
Is it still worth splitting CLI subcommands into crates?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 584
- Forks
- 63
- Avg merge
- 3h
- Merged PRs (30d)
- 2
Description
In https://github.com/oxidecomputer/humility/pull/50, the cmd/ subfolder was split into many crates to aid with build times. Helpful commit message:
commit 93715f6819e754524cca68d62184442be387b17a
Author: Bryan Cantrill
Date: Thu Dec 2 00:59:16 2021 -0800
refactor commands in terms of crates (#50)
This work refactors Humility commands to each be in their own crate
(which in turn necessitated moving debugger functionality in its own
crates that debugger command crates can then depend upon). The reason
to do this is severalfold, but the most immediately pressing concern
is build times: prior to this work, an empty change to a command
would result in a build time of over 35 seconds on an 8-core Intel
Core i7 (!); after this work, the same empty change results in a build
time of 6 seconds.
Since then, there have been some improvements to parallelizing compilation, as well as incremental builds. The existence of multiple crates leads to a somewhat unfortunate amount of duck-typing in service of codegen purposes, c.f. https://github.com/oxidecomputer/humility/pull/666, so it might be nice to return these to a single crate where we could use a much simpler decl macro or such to generate the top level subcommand enum.
If we find that the split is still worth the compile time improvements, we might want to capture this explanation in either the top level README, or in a README in cmd/, to satisfy curious developers like myself who wonder "why is this like this".
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the cmd/ crate layout and the history of pull requests #50 and #666 first. Compare the current build-time rationale with the complexity introduced by the split, then decide whether to consolidate the crates or document the rationale in the top-level README or cmd/README. Done means the preferred direction and its scope are recorded clearly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100