Benchmark cp + git on linux v.s. Windows: why such differences?

て烟熏妆下的殇ゞ 提交于 2019-12-13 15:53:20

问题


I have created a large amount of files using this Python script that I used primarily to benchmark Git.

The result is very surprising especially the differences between Windows and Linux.

Basically my script creates 12 directories with 512 files in each of them. Each file is about 2 to 4 kB. With the Git objects the repository is about 12k files.

I benchmarked:

  1. Time to add all the files to git git add .
  2. Time to checkout a previous branch
  3. Time to copy the repository on the same SSD
  4. Time to copy the repository to an external Sata HDD (NTFS)

I did this with the very same repository on both Windows 10 and Linux:

 Operation               Linux     Windows    Ratio
 ---------               -----     -------    -----
 1. git add .            0.47s      21.7s      x46
 2. git checkout HEAD~1  0.35s      16.2s      x46 
 3. git checkout .       0.40s      20.5s      x50
 4. cp -r ssd->ssd       0.35s      1m14s      x211
 5. cp -r ssd->hdd       4.90s      6m25s      x78 

The operation was done in this order:

$ mkdir test
$ cp test.py test && cd test
$ ./test.py # Creation of the files
$ git init
$ time git add .               # (1)
$ git commit -qam 1
$ ./test.py # Alter some files
$ commit -qam 2

$ cd ..
$ time cp -r test /media/hdd/  # (4)
$ time cp -r test test2        # (5)
$ cd test

$ time git checkout HEAD~1     # (2)
$ ./test.py 
$ git checkout master
$ git reset --soft head~1
$ time git checkout .          # (3)

The benchmark was done on the same PC (using dual boot).

Why such differences? I can not believe it.

来源:https://stackoverflow.com/questions/36923253/benchmark-cp-git-on-linux-v-s-windows-why-such-differences

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!