Skip to content

perf/startup speed#286

Draft
dbosk wants to merge 2 commits into
mainfrom
perf/startup-speed
Draft

perf/startup speed#286
dbosk wants to merge 2 commits into
mainfrom
perf/startup-speed

Conversation

@dbosk

@dbosk dbosk commented Mar 5, 2026

Copy link
Copy Markdown
Owner
  • Defer heavy imports to command bodies in cli modules
  • Cache get_tracking_dir and read session files directly in status

dbosk and others added 2 commits March 5, 2026 09:32
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant