_examples: Add performance focused clone example This example focuses on the least consumptiong of memory, while also taking into account the total operation time.
The go-git compared to its git CLI counterpart:
go run _examples/clone/fast/main.go https://github.com/go-git/go-git /tmp/go-git-clone
GIT_TRACE_PERFORMANCE=true git clone --no-tags --depth 1 --single-branch https://github.com/go-git/go-git /tmp/go-git-clone
10:15:50.616532 upload_pack.go:41: performance: 0.234388589 s: upload_pack
Enumerating objects: 582, done.
Counting objects: 100% (582/582), done.
Compressing objects: 100% (531/531), done.
Total 582 (delta 31), reused 165 (delta 10), pack-reused 0 (from 0)
10:15:50.683061 common.go:32: performance: 0.066241589 s: update_obj_storage
10:15:50.811161 worktree.go:366: performance: 0.127937022 s: reset_worktree
10:15:50.811257 repository.go:489: performance: 0.597924171 s: git command: git clone https://github.com/go-git/go-git
commit 9973a38aa942b2f177416d0e4b07832bb15e621e
GIT_TRACE_PERFORMANCE=true git clone --depth 1 --single-branch https://github.com/go-git/go-git /tmp/git-cli-clone
Cloning into '/tmp/git-cli-clone'...
remote: Enumerating objects: 582, done.
remote: Counting objects: 100% (582/582), done.
remote: Compressing objects: 100% (531/531), done.
remote: Total 582 (delta 31), reused 165 (delta 10), pack-reused 0 (from 0)
Receiving objects: 100% (582/582), 654.33 KiB | 6.00 MiB/s, done.
Resolving deltas: 100% (31/31), done.
10:23:04.662692 trace.c:416 performance: 0.205806146 s: git command: /usr/libexec/git/git --shallow-file /tmp/git-cli-clone/.git/shallow.lock index-pack --stdin -v --fix-thin '--keep=fetch-pack 122550 on localhost.localdomain'
10:23:04.662821 trace.c:416 performance: 0.607833632 s: git command: /usr/libexec/git/git remote-https origin https://github.com/go-git/go-git
10:23:04.664931 trace.c:416 performance: 0.000640393 s: git command: /usr/libexec/git/git rev-list --objects --stdin --not --all --quiet --alternate-refs '--progress=Checking connectivity'
10:23:04.667253 unpack-trees.c:2009 performance: 0.000710704 s: traverse_trees
10:23:04.678219 unpack-trees.c:511 performance: 0.010950771 s: check_updates
10:23:04.678465 cache-tree.c:491 performance: 0.000228486 s: cache_tree_update
10:23:04.678472 unpack-trees.c:2106 performance: 0.011949092 s: unpack_trees
10:23:04.678728 read-cache.c:3114 performance: 0.000251809 s: write index, changed mask = 2a
10:23:04.678772 trace.c:416 performance: 0.628392351 s: git command: git clone --depth 1 --single-branch https://github.com/go-git/go-git /tmp/git-cli-clone
Signed-off-by: Paulo Gomes <pjbgf@linux.com>