Last active
June 15, 2023 23:11
-
-
Save eevmanu/76899a770bf57cb7861c36db5517f765 to your computer and use it in GitHub Desktop.
bash benchamrking in nanoseconds
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
start=$(date +%s%N) | |
# any command | |
end=$(date +%s%N) | |
elapsed_nanosec=$((end - start)) | |
formatted_elapsed_nanosec=$(printf "%'d" "$elapsed_nanosec" | sed 's/,/_/g') | |
echo "Elapsed time: $formatted_elapsed_nanosec nanoseconds" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment