Last active
November 15, 2016 10:33
-
-
Save greymd/aef25feb6e43dd566aab13a93e23cab4 to your computer and use it in GitHub Desktop.
シェル上での冪乗計算の速さ比較
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
# ruby | |
$ time bash -c 'ruby -e "print 12345**54321"' >/dev/null | |
bash -c 'ruby -e "print 12345**54321"' > /dev/null 0.57s user 0.37s system 91% cpu 1.027 total | |
# bc | |
$ time bash -c 'echo "12345^54321" | bc' >/dev/null | |
bash -c 'echo "12345^54321" | bc' > /dev/null 3.15s user 0.06s system 81% cpu 3.942 total | |
# python | |
$ time bash -c 'echo "print pow(12345,54321)" | python' >/dev/null | |
bash -c 'echo "print pow(12345,54321)" | python' > /dev/null 0.86s user 0.02s system 98% cpu 0.891 total | |
# えぎそんーがんばえー | |
$ time bash -c "egison -e '(power 12345 54321)'" >/dev/null | |
bash -c "egison -e '(power 12345 54321)'" > /dev/null 23.10s user 0.50s system 90% cpu 26.210 total | |
# infだと言って諦めるawkさんとperlさん | |
$ time bash -c 'perl -e "print 12345**54321"' | |
inf | |
$ time bash -c 'echo | awk "{print 12345**54321}"' | |
inf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment