title: Why are programs in `C:\Program Files\Git\usr\bin` slow on Windows?
body: <p>For a long time, I was under the impression that Git on Windows was very slow. I've seen several articles and SO posts that revolve around that. I've tried several of them:</p>
  <ul>
  <li>Disabling the <code>__ps1</code> stuff</li>
  <li>Adding exclusion in Antivirus software (Windows Defender)</li>
  <li>Using installer instead of portable version</li>
  </ul>
  <p>Today, I found another SO post which suggested using <code>GIT_TRACE=1</code> to debug what's happening when a git command runs. Here's a sample output:</p>
  <pre><code>19:47:42.207480 exec-cmd.c:237          trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
  19:47:42.211593 git.c:455               trace: built-in: git diff 0.todo
  19:47:42.260647 run-command.c:666       trace: run_command: unset GIT_PAGER_IN_USE; LESS=FRX LV=-c less
  diff --git a/0.todo b/0.todo
  index 740ccba..1db29d6 100644
  
  ...git diff output...
  </code></pre>
  <p>This shows that the git commands themselves are not taking a lot of time. The last action which depends on <code>less</code> is the one taking most of the time.</p>
  <p>I verified this by running the <code>less</code> command directly. It's slow. But if I run it once or twice, the subsequent runs are normal. If I close that command prompt and open a new one, the first run is very slow (5+ seconds).</p>
  <p>I ran some other commands found within <code>C:\Program Files\Git\usr\bin</code>: <code>base64</code>, <code>ls</code>, etc. Same result.</p>
  <p>So, I've concluded that this folder is the cause for the slowness of git commands on Windows.
  But, how do I go about fixing it? How should I debug? What more information can I provide here that'll enable someone to help me?</p>