question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Speed up checkout by fetching minimal data from remote and lazily loading it later

See original GitHub issue

One of my big annoyances with the extension is how long it takes to checkout a branch, particularly on the first time checking this out. It’s also even worse on Windows as git seems to be a little slower (due to FS?). This problem is also much worth with larger repos due to the size of the history, branch/tag count, etc.

I’m proposing that when a PR is checked out for the first time we fetch just the branch (r branch) and no history (--depth=1), something like this:

git remote add r
git fetch --depth 1 r branch
git checkout remote_branch

The history and rest of branches can then be lazily fetched later with this:

git fetch --unshallow r

Based on my testing this should provide a very significant speed up:

Normal fetch and checkout:

powershell -Command "Measure-Command {git remote add r https://github.com/Tyriar/xterm.js; git fetch r}"
...
Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 2
Milliseconds      : 935
Ticks             : 29353111
TotalDays         : 3.39735081018518E-05
TotalHours        : 0.000815364194444444
TotalMinutes      : 0.0489218516666667
TotalSeconds      : 2.9353111
TotalMilliseconds : 2935.3111

Fetch remote branch only with no history:

powershell -Command "Measure-Command {git remote add r https://github.com/Tyriar/xterm.js; git fetch --depth 1 r 1747_npe}"
...
Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 1
Milliseconds      : 149
Ticks             : 11490152
TotalDays         : 1.3298787037037E-05
TotalHours        : 0.000319170888888889
TotalMinutes      : 0.0191502533333333
TotalSeconds      : 1.1490152
TotalMilliseconds : 1149.0152

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
rebornixcommented, Jan 7, 2019

@Tyriar some work still needs to be done from extension side, will send out a pr.

0reactions
Tyriarcommented, Jan 7, 2019

@rebornix is all done for this on the extension side? Looking forward to testing it out 🙂

Read more comments on GitHub >

github_iconTop Results From Across the Web

Five Data-Loading Patterns To Boost Web Performance
Lazy loading is a common data-loading pattern that makes the client load à la carte results, not loading everything until the client needs...
Read more >
Lazy Loading: How It Decreases Load Time and Increases ...
Lazy loading reduces the time it takes for a web page to open because the browser only loads a fraction of the content...
Read more >
Get up to speed with partial clone and shallow clone
The new blobs are downloaded only after a git checkout . Note that git pull runs git fetch and then git merge ,...
Read more >
Shallow AND Sparse GIT Repository Clone
Initially I was able to limit the cloned repository to only the sparse checkout by disabling checkout when cloning. Then setting up sparse ......
Read more >
Caching Best Practices | Amazon Web Services
Lazy caching · Your app receives a query for data, for example the top 10 most recent news stories. · Your app checks...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found