Created
May 6, 2020 09:24
-
-
Save orlandothoeny/6b120b49b072991e1bbc81e49d51e28a to your computer and use it in GitHub Desktop.
Compares time of cloning a Git repository vs. compressing & extracting it. GIT_REPOSITORY_URL needs to be set.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
start=$(date +%s) | |
git clone ${GIT_REPOSITORY_URL} git-repo | |
end=$(date +%s) | |
runtime=$((end-start)) | |
printf 'Git clone time: %s seconds\n' "${runtime}" | |
mkdir extracted-tar | |
startCompress=$(date +%s) | |
tar -C ./git-repo -cf release-build-artifact.tar . | |
endCompress=$(date +%s) | |
startExtract=$(date +%s) | |
tar -xf ./release-build-artifact.tar -C ./extracted-tar/ | |
endExtract=$(date +%s) | |
compressTime=$((endCompress-startCompress)) | |
extractTime=$((endExtract-startExtract)) | |
printf 'Tar compress time: %s seconds\n' "${compressTime}" | |
printf 'Tar extract time: %s seconds\n' "${extractTime}" | |
printf 'Tar compress + extract time: %s seconds\n' "$((compressTime+extractTime))" | |
rm -rf ./git-repo | |
rm -rf ./extracted-tar | |
rm -rf release-build-artifact.tar | |
printf 'Done\n' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment