Skip to content

Instantly share code, notes, and snippets.

@janstuemmel
Last active August 28, 2017 11:48
Show Gist options
  • Select an option

  • Save janstuemmel/411ae599f7d687879eeff10881f5b2fb to your computer and use it in GitHub Desktop.

Select an option

Save janstuemmel/411ae599f7d687879eeff10881f5b2fb to your computer and use it in GitHub Desktop.
tar+cp/rsync speed
#!/bin/bash
mkdir -p caching_speed_rsync &&
cd caching_speed_rsync &&
npm init -y &&
npm install --save lodash express jest react &&
mkdir -p /tmp/test-cache/node_modules &&
echo "Copying cache" &&
time rsync -aHA --delete node_modules /tmp/test-cache/node_modules
echo "----------------------" && echo &&
rm -rf node_modules &&
echo "Restoring cache" &&
time rsync -aHA --delete /tmp/test-cache/node_modules node_modules
echo "----------------------" && echo
#!/bin/bash
mkdir -p caching_speed_tar &&
cd caching_speed_tar &&
npm init -y &&
npm install --save lodash express jest react &&
echo "Archiving node_modules" &&
time tar -czf node_modules.tar.gz node_modules &&
echo "----------------------" && echo &&
mkdir -p /tmp/test-cache &&
echo "Copying cache" &&
time cp node_modules.tar.gz /tmp/test-cache &&
echo "----------------------" && echo &&
rm -rf node_modules &&
echo "Restoring cache" &&
time tar -xzf /tmp/test-cache/node_modules.tar.gz
echo "----------------------" && echo
#### RSYNC
Copying cache
real 0m4.776s
user 0m0.416s
sys 0m0.800s
----------------------
Restoring cache
real 0m2.033s
user 0m0.400s
sys 0m0.772s
----------------------
#### TAR
Archiving node_modules
real 0m1.971s
user 0m1.612s
sys 0m0.164s
----------------------
Copying cache
real 0m0.060s
user 0m0.000s
sys 0m0.012s
----------------------
Restoring cache
real 0m0.783s
user 0m0.384s
sys 0m0.388s
----------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment