Skip to content

About high CPU and severe UI input lag #36752

Description

@lclgames2022-ctrl

Summary

I found a reproducible performance issue in the Codex/ChatGPT Windows desktop app related to the Git Changes/Summary integration.

When the currently maintained branch has diverged significantly from an obsolete main branch, the Codex app appears to continuously recalculate or refresh the branch comparison shown in the Changes/Summary panel.

In my case, the current branch differed from origin/main by approximately:

  • +3.3 million lines
  • -325,000 lines

The app displayed these numbers in the branch comparison view.

Whenever a file changed, a Codex command ran, Unity compiled, or text was entered/output in the UI, the app appeared to refresh this very large comparison again.

This caused:

  • CPU usage spikes of 70–100% on one desktop PC
  • High WMI Provider Host and PowerShell activity
  • Unity performance measurements becoming unreliable
  • Severe text input and general UI lag on an older laptop
  • High CPU on the first app launch of the day, followed by temporary recovery
  • Sustained high CPU whenever the Unity project was compiling or changing files

Environment

Affected Codex/ChatGPT Windows App version:

26.715.10079.0

Git for Windows version tested:

2.43.0.windows.1

The affected repository is a large Unity project.

The repository was originally cloned from main. Development later moved permanently to another long-lived branch, while main became obsolete. The two branches eventually differed by several million lines.

Important observations

  1. Renaming the repository folder:

    .git -> .git_disabled_test

    immediately stopped the high CPU usage and UI lag.

  2. Restoring the .git folder caused the problem to return.

  3. Manually running Git status was fast:

    git status --porcelain=v1 -uno: approximately 81 ms

    git status --porcelain=v1: approximately 64 ms

    Therefore, the repository itself was not slow when running a single Git status command.

  4. A newly cloned copy of the maintained branch on another desktop did not reproduce the issue.

    On that machine, the Codex Changes panel showed zero branch changes and the app remained responsive.

  5. The same underlying problem produced different symptoms on different hardware:

    • Faster desktop: very high CPU usage
    • Older laptop: severe UI typing and rendering lag
  6. Large unstaged changes also amplified the problem. For example, importing a Unity effects package added approximately 600,000 unstaged lines. Committing the package reduced the amount of work shown in the Changes panel.

  7. The .git folder size alone does not appear to be the root cause:

    • One affected repository had approximately 616 MB of Git metadata.
    • The older laptop had approximately 3 GB of Git metadata.
    • The key trigger appeared to be the huge active branch comparison and repeated refresh behavior.

Steps to reproduce

  1. On Windows, open a Git repository in the Codex desktop app.
  2. Use a current branch that has diverged from main by several million lines.
  3. Allow the Changes/Summary panel to compare the current branch against origin/main.
  4. Open the project conversation.
  5. Edit or create files, run Codex commands, or trigger an external build that changes project files.
  6. Observe Task Manager and UI responsiveness.
  7. Note that CPU, WMI Provider Host, PowerShell, or Git-related activity increases whenever the Changes view refreshes.
  8. Close the Codex app or temporarily rename .git.
  9. Observe that CPU usage and UI responsiveness return to normal.

Actual behavior

The app appears to repeatedly refresh or recalculate a multi-million-line branch comparison whenever repository files change or commands run.

This can consume a large amount of CPU and make the entire Codex UI unresponsive.

The issue is especially noticeable in large Unity repositories where compilation and asset imports produce frequent filesystem changes.

Expected behavior

The Codex desktop app should not continuously recalculate or render the complete branch diff after every filesystem event, command execution, input event, or UI update.

Suggested improvements:

  • Debounce and throttle Git refreshes.
  • Cache branch comparison statistics.
  • Recalculate only files affected by relevant Git changes.
  • Lazily calculate large Diff statistics only when the Changes panel is opened.
  • Do not continuously refresh a collapsed or hidden Changes panel.
  • Allow users to select the comparison/base branch.
  • Allow users to disable Git integration for a project.
  • Warn when a branch comparison contains millions of changed lines.
  • Avoid comparing against an obsolete main branch automatically.
  • Avoid recalculating branch-level Diff when only unstaged changes need to be displayed.

Workarounds discovered

The following workarounds resolved or significantly reduced the problem:

  1. Temporarily rename .git to disable Git detection.

    Warning: this disables Git functionality and should only be used as a temporary diagnostic workaround.

  2. Align the maintained branch with the repository's default/main comparison branch.

  3. Change the comparison baseline from obsolete main to the actual maintained branch or its remote tracking branch.

  4. Commit or remove very large unstaged changes instead of leaving hundreds of thousands of changed lines in the working tree.

  5. Clone only the currently maintained branch into a clean directory.

  6. Keep the Changes/Summary count near zero or at a manageable size.

  7. Fully close the Codex app before performance testing another application.

Impact

This issue initially caused me to incorrectly conclude that a new Unity feature had introduced a major performance regression.

After reverting the feature, I discovered that the actual performance loss came from the Codex desktop app consuming CPU while continuously refreshing Git comparison information.

This makes the problem particularly serious for developers performing CPU-sensitive profiling, compilation, game development, or other real-time workloads.

I can provide screenshots showing:

  • The +3.3 million / -325,000 branch comparison
  • The +600,000 unstaged changes
  • Task Manager CPU usage
  • WMI Provider Host activity
  • CPU usage before and after renaming .git

Metadata

Metadata

Assignees

No one assigned

    Labels

    appIssues related to the Codex desktop appbugSomething isn't workingperformancewindows-osIssues related to Codex on Windows systems

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions