Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- string="abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
- loops=10000000
- echo 'empty loop'
- i=0
- start=$(date +%s)
- while [ $i -lt $loops ]; do
- :
- i=$((i+1))
- done
- echo "took $(($(date +%s) - start))s"
- echo 'checking with = ""'
- i=0
- start=$(date +%s)
- while [ $i -lt $loops ]; do
- [ "$string" = "" ]
- i=$((i+1))
- done
- echo "took $(($(date +%s) - start))s"
- echo 'checking with = ${#} -ne 0'
- i=0
- start=$(date +%s)
- while [ $i -lt $loops ]; do
- [ ${#string} -eq 0 ]
- i=$((i+1))
- done
- echo "took $(($(date +%s) - start))s"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement