Skip to content

Instantly share code, notes, and snippets.

@superbrothers
Created March 30, 2017 16:12
Show Gist options
  • Save superbrothers/5f0365701ecfeb58425e21893d56e861 to your computer and use it in GitHub Desktop.
Save superbrothers/5f0365701ecfeb58425e21893d56e861 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -e
tempfile="$(mktemp)"
trap "rm -rf $tempfile" EXIT
dd if=/dev/zero of=$tempfile bs=1M count=1
start="$(date +%s%N)"
for ((i=0; i<1000; i++)); do
md5sum $tempfile >/dev/null 2>&1
done
echo "md5sum: $(( $(date +%s%N) - $start))"
start="$(date +%s%N)"
for ((i=0; i<1000; i++)); do
stat -c '%y' $tempfile >/dev/null 2>&1
done
echo "stat: $(( $(date +%s%N) - $start))"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment