perf: defer heavy imports in giant/dwarf CLIs until commands run #91
Reference in New Issue
Block a user
Delete Branch "cli-lazy-imports"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
torch/pandas/pyarrow/polars/uproot/awkward/particle were all imported
at module scope in giant/cli.py and giant/tools/dwarf.py, so even
--helppaid ~1.6-1.9s of import cost. Move those imports into thecommand bodies that actually need them (following the deferred-import
pattern already used for analysis/render/plots/sklearn/wandb), cutting
giant --helpto ~0.3s anddwarf --helpto ~0.2s with no change toany command's actual behavior.
Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com