Skip to content

gitui extremely slow on large repositories #2823

@DannyStoll1

Description

@DannyStoll1

Describe the bug

gitui can take 5+ minutes to load the status view on very large repositories, while git status and gix status complete in ~2 seconds.

To Reproduce
Steps to reproduce the behavior:

  1. Open gitui in a very large repository
  2. Navigate to the Status tab
  3. Observe the endless loading spinner

Expected behavior
Status should load in a few seconds, similar to git status or gix status.

Environment

  • gitui version: 0.27/0.28
  • OS: Rocky Linux 8.6
  • Rust version: 1.94.0-nightly (also tested on stable 1.92.0)
  • Repository size: 1.7M files (uses git-lfs)

Additional context
Profiling revealed that the git index was being loaded 30+ times during startup.
I believe this is caused by asyncgit's StatusParams including a millisecond timestamp (tick) in its hash:

// asyncgit/src/status.rs
pub struct StatusParams {
    tick: u128, // milliseconds since epoch
    status_type: StatusType,
    config: Option<ShowUntrackedFilesConfig>,
}

The tick field was intended to force periodic re-fetches to detect external file changes.

However, because it changes every millisecond, the cache hash changes on every UI tick (every 5 seconds by default), causing a deadly cycle:

  1. Cache miss => start new fetch
  2. While fetch is pending, more ticks occur
  3. Each tick after fetch completes triggers another cache miss
  4. Result: dozens of index loads, each taking ~15 seconds on my target repo

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions