Skip to content

Is it still worth splitting CLI subcommands into crates? #678

@jamesmunns

Description

@jamesmunns

In #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. #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".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions