Reduce CLI startup latency by deferring eager startup paths#20643
Reduce CLI startup latency by deferring eager startup paths#20643wolph wants to merge 4 commits intogoogle-gemini:mainfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the CLI's startup performance by strategically deferring several eager initialization paths. The changes ensure that heavyweight modules and UI components are only loaded when strictly necessary, such as for interactive sessions, while providing a rapid response for lightweight commands like Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces significant startup latency improvements by deferring expensive initialization paths. The strategies employed, such as adding a fast path for --version, lazy loading UI components and editor checks, and avoiding unnecessary process relaunches for non-interactive runs, are well-executed and the benchmark results are impressive. The refactoring to break an import cycle is also a good structural improvement. The feedback regarding outputListeners.ts has been retained as it does not contradict any existing rules.
|
Hi there! Thank you for your interest in contributing to Gemini CLI. To ensure we maintain high code quality and focus on our prioritized roadmap, we have updated our contribution policy (see Discussion #17383). We only guarantee review and consideration of pull requests for issues that are explicitly labeled as 'help wanted'. All other community pull requests are subject to closure after 14 days if they do not align with our current focus areas. For this reason, we strongly recommend that contributors only submit pull requests against issues explicitly labeled as 'help-wanted'. This pull request is being closed as it has been open for 14 days without a 'help wanted' designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding and for being part of our community! |
Fixes #10726
Summary
This change reduces startup latency by removing several eager startup paths that were being triggered even for lightweight or non-interactive invocations.
What changed
Benchmarks
Measured on Windows (same machine), using local built CLI (
ode packages/cli/dist/index.js).
Before (clean checkout, pre-patch):
After (this branch):
Validation
pm run typecheck --workspace @google/gemini-cli
px eslint on all modified files
pm run test --workspace @google/gemini-cli -- src/gemini.test.tsx src/commands/extensions.test.tsx src/commands/skills.test.tsx src/commands/mcp.test.ts src/ui/editors/editorSettingsManager.test.ts
pm run test --workspace @google/gemini-cli (full suite) still has pre-existing environment-specific failures unrelated to touched files (policy-engine integration expectations, terminal notification assertions, and snapshot differences in stats/session summary components).