Skip to content

gh extension list is very slow #4220

Description

@waldyrious

Describe the bug

Listing the installed extensions seems to be extremely slow.

Steps to reproduce the behavior

$ time gh extension list
gh branch          mislav/gh-branch              
gh clean-branches  davidraviv/gh-clean-branches  
gh clone-org       matt-bartel/gh-clone-org      
gh user-stars      korosuke613/gh-user-stars     

real	0m8,439s
user	0m0,204s
sys	0m0,080s

I can replicate this multiple times.

Expected vs actual behavior

Since the extensions are installed locally, I'd expect the listing of installed extensions to be very fast, e.g.

$ time ls -1 /home/waldyrious/.local/share/gh/extensions/
gh-branch
gh-clean-branches
gh-clone-org
gh-user-stars

real	0m0,001s
user	0m0,001s
sys	0m0,000s

Maybe there should be a command-line option to toggle whatever slow step is taking place when listing the extensions?

Activity

  1. mislav commented on Aug 30, 2021

    @mislav
    Contributor

    Listing extensions is slow because it checks on GitHub for every extension whether it has updates (i.e. has newer commits pushed)

    if includeMetadata {
    remoteUrl = m.getRemoteUrl(f.Name())
    updateAvailable = m.checkUpdateAvailable(f.Name())
    }

    We could probably speed it up by avoiding doing this check too often.

  2. added
    priority-2Affects more than a few users but doesn't prevent core functions
    on Aug 30, 2021
  3. waldyrious commented on Aug 30, 2021

    @waldyrious
    ContributorAuthor

    We could probably speed it up by avoiding doing this check too often.

    IMO the default behavior should be to not do this check by default, and maybe print a message if the last check was too long ago, suggesting the user to run gh extension list --check (or whatever other flag name would be acceptable). That way, the slow behavior would be opt-in and deterministic, rather than "smartly" snuck in in some invocations of the command and not in others.

  4. self-assigned this
    on Oct 4, 2021
  5. waldyrious commented on Oct 20, 2021

    @waldyrious
    ContributorAuthor

    Hey @samcoe — I have had the chance to test gh 2.1.0, but even with this check for updates now done concurrently (thanks to #4396), it is still taking me several seconds to see the output (even more than before, ironically — although of course network latency variations will affect the results). As the original reporter, I would not consider this issue resolved until the times are much closer to a plain listing of ~/.local/share/gh/extensions/. Please reopen the issue.

  6. samcoe commented on Oct 20, 2021

    @samcoe
    Contributor

    @waldyrious Thanks for the update that you are still experiencing this issue. I will reopen it. As next steps for speeding this up I think the only real option is to try to reduce the number of network requests. Two options there are to do caching and only checking for updates every 24hr (for example) or introducing a flag that specifies that extension list should or shouldn't check for updates as you mentioned in your previous comment. We could also do a combination of both where the new flag will force a update check otherwise only check for updates on a specified interval.

    @mislav @vilmibm What are your thoughts?

  7. reopened this on Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpriority-2Affects more than a few users but doesn't prevent core functions

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions