Skip to content

🐛 Delta is slow at startup (2 seconds) #2030

Closed

Description

@Xadeck

I use delta version 18.0.2 both on my work laptop (Macbook, homebrew version) and on my workstation at work (a modified Debian 6.12.32 maintained by Google for its engineers). On the laptop, time delta shows 68.ms but on my workstation:

The main way to use delta is to configure it as the pager for git: see https://github.com/dandavison/delta#get-started. You can also use delta to diff two files: `delta file_A file_B`.

________________________________________________________
Executed in    2.38 secs    fish           external
   usr time    0.15 secs    1.07 millis    0.15 secs
   sys time    2.24 secs    0.21 millis    2.24 secs

Both laptop and workstation have the same dotrc files, so I'd rule this out. In both cases, I try in a /tmp/test empty directory so that it's not due to some slow mounted filesystem.

Is there sometihng special that delta does at startup, like searching for something, that could explain such a delay (because my workstation would have this something slower to find/access)? Any suggestion on how to investigate?

This makes delta basically unusable.

Activity

  1. dandavison commented on Sep 3, 2025

    @dandavison
    Owner

    Can you try setting either dark=true or light=true? Terminal background color autodetection is the most likely culprit.

  2. Xadeck commented on Sep 3, 2025

    @Xadeck
    Author

    I should have mentioned that I tried that (reading other bugs related to slowness) with time delta --dark. Still very slow.

  3. dandavison commented on Sep 3, 2025

    @dandavison
    Owner

    Is it slow with --no-gitconfig? E.g. what do you get for this?

    $ time delta --no-gitconfig
    The main way to use delta is to configure it as the pager for git: see https://github.com/dandavison/delta#get-started. You can also use delta to diff two files: `delta file_A file_B`.
    delta --no-gitconfig  0.01s user 0.03s system 104% cpu 0.035 total
    
  4. Xadeck commented on Sep 4, 2025

    @Xadeck
    Author

    That's the right direction. With --no-gitconfig it's fast. I dug a bit, and there are two aspects:

    1. in a directory our specially mounted filesystem, where working directories are usually deep and are not git versioned, it seems searching the .gitconfig upward is adding 600ms.

    2. I bissected my .gitconfig until I could find that any of the two commented lines adds 2s of slowliness.

    [delta]
        navigate = true    # use n and N to move between diff sections
        dark = true
        #side-by-side = true
        hyperlinks = false
        #line-numbers = true
        line-numbers-left-format = "{nm:>3}┊"
        line-numbers-right-format = "{np:>3}│"
        syntax-theme = Solarized (dark)

    I wondered if those options require querying the terminal for some information, and maybe Kitty was special. But Xterm also exhibits the issue.

    So to summarize, the situation is:

    ╰─ time delta --no-gitconfig
    ________________________________________________________
    Executed in   15.23 millis    fish           external
       usr time    2.56 millis    1.16 millis    1.41 millis
       sys time   20.89 millis    0.23 millis   20.66 millis
    
    ╰─ time delta --no-gitconfig -s 
    ________________________________________________________
    Executed in    2.04 secs    fish           external
       usr time    0.12 secs    0.00 millis    0.12 secs
       sys time    1.92 secs    1.54 millis    1.92 secs
  5. Repository owner locked and limited conversation to collaborators on Sep 4, 2025
  6. converted this issue into a discussion #2035 on Sep 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions