Skip to content

Conversation

bhouston
Copy link
Member

@bhouston bhouston commented Mar 5, 2025

Fix Double Yargs Initialization in CLI Profiling Feature

This PR fixes an issue in PR #101 where yargs was being initialized twice in the main function. This double initialization was done to check for the profiling flag early, but it's inefficient and could cause problems.

Changes

  1. Modified the performance.ts module to always collect timing data regardless of whether profiling is enabled

    • Only the reporting of the data is conditional on the profiling flag
    • This allows us to collect all timing data without needing to know if profiling is enabled upfront
  2. Removed the early yargs initialization in the main function

    • Now we only initialize yargs once
    • The profiling flag is checked after yargs has been properly initialized
  3. Updated tests to reflect the changes

Related Issues

Fixes part of #100 (CLI startup performance issues)
Should be merged into PR #101

Testing

All functionality of the profiling feature remains intact, but the implementation is now more efficient.

@bhouston bhouston merged commit 4bae99b into feature/cli-profiling Mar 5, 2025
Copy link

🎉 This PR is included in version mycoder-v1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@bhouston bhouston deleted the fix/cli-profiling-double-yargs branch March 12, 2025 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant