perf/startup speed#286
Draft
dbosk wants to merge 2 commits into
Draft
Conversation
dbosk
commented
Mar 5, 2026
Owner
- Defer heavy imports to command bodies in cli modules
- Cache get_tracking_dir and read session files directly in status
Move imports of arrow, ics, requests (via nytid.signup.sheets) and nytid.signup.hr out of module level and into the function bodies that actually need them. This prevents Python from loading those heavy dependencies on every nytid invocation, regardless of which subcommand is used. - signupsheets.nw: defer sheets/utils imports to generate command - schedule.nw: defer sheets/schedutils/ics/arrow imports to ics and show commands; defer arrow/dateutil/ics.event to schedule_todo_events - hr.nw: defer sheets/hr imports to booking commands; defer timesheet to the --excel path only; fix add_reserve_to_title to import sheets lazily so tests pass without module-level side-effects Co-authored-by: OpenCode <noreply@opencode.ai>
Two small performance improvements to nytid track status: - Add @functools.lru_cache to get_tracking_dir() so the config lookup happens only once per process instead of on every call across all subcommands. - In show-all-workers status, open each session file directly from the path already obtained via glob, instead of calling load_active_session which would re-derive the same path through get_current_session_file. Co-authored-by: OpenCode <noreply@opencode.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.