-
-
Save felipernb/822579 to your computer and use it in GitHub Desktop.
mustang:~ fribeiro$ time `python -c "print(12345 ** 54321)" > /dev/null` | |
real 0m22.969s | |
user 0m22.531s | |
sys 0m0.059s | |
mustang:~ fribeiro$ time `ruby -e "puts 12345**54321" > /dev/null` | |
real 0m10.007s | |
user 0m9.943s | |
sys 0m0.022s | |
mustang:~ fribeiro$ time `php -r "echo bcpow(12345,54321);" > /dev/null` | |
real 0m4.191s | |
user 0m4.149s | |
sys 0m0.026s |
mustang:~ fribeiro$ php -r "echo bcpow(12345,54321);" > php.out | |
mustang:~ fribeiro$ ruby -e "puts 12345**54321" > ruby.out | |
mustang:~ fribeiro$ python -c "print(12345 ** 54321)" > python.out | |
mustang:~ fribeiro$ md5 *.out | |
MD5 (php.out) = b9e70261cddc56351f9e400ec008ca05 | |
MD5 (python.out) = 1089774eed3ff3f524a60d83d1747cf2 | |
MD5 (ruby.out) = 1089774eed3ff3f524a60d83d1747cf2 |
mustang:~ fribeiro$ file *.out | |
php.out: ASCII text, with no line terminators | |
python.out: ASCII text | |
ruby.out: ASCII text |
mustang:~ fribeiro$ ruby -e "puts 12345**54321" > ruby.out | |
mustang:~ fribeiro$ python -c "print(12345 ** 54321)" > python.out | |
mustang:~ fribeiro$ php -r "echo bcpow(12345,54321);" > php.out | |
mustang:~ fribeiro$ echo "" >> php.out | |
mustang:~ fribeiro$ md5 *.out | |
MD5 (php.out) = 1089774eed3ff3f524a60d83d1747cf2 | |
MD5 (python.out) = 1089774eed3ff3f524a60d83d1747cf2 | |
MD5 (ruby.out) = 1089774eed3ff3f524a60d83d1747cf2 |
I just tested with pypy which is a python with jit, however for long it is slow for now.
/*
$ 6g p.go && 6l -o p p.6 && time ./p > /dev/null
real 0m1.882s
user 0m1.809s
sys 0m0.010s
*/
package main
import (
"fmt"
"big"
)
func main() {
x := big.NewInt(12345)
y := big.NewInt(54321)
x.Exp(x, y, nil)
fmt.Println(x)
}
Go after restart my laptop
real 0m1.760s
user 0m1.748s
sys 0m0.008s
golang
tony@hitman:~$ python --version && time python -c "print(12345 ** 54321)" > /dev/null
Python 2.7.1+
real 0m1.329s
user 0m1.320s
sys 0m0.010s
tony@hitman:$$
tony@hitman:
tony@hitman:~$ ruby1.9.1 --version && time ruby1.9.1 -e "puts 12345**54321" > /dev/null
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-linux]
real 0m0.803s
user 0m0.780s
sys 0m0.020s
tony@hitman:$$
tony@hitman:
tony@hitman:~$ php --version && time php -r "echo bcpow(12345,54321);" > /dev/null
PHP 5.3.5-1ubuntu7.3 with Suhosin-Patch (cli) (built: Oct 13 2011 22:20:48)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
real 0m3.884s
user 0m3.880s
sys 0m0.000s
Yeah, I don't know what happened at that time:
mustang:~ fribeiro$ time
python -c "print(12345 ** 54321)" > /dev/null
real 0m2.046s
user 0m2.004s
sys 0m0.017s
mustang:~ fribeiro$ time
ruby -e "puts 12345**54321" > /dev/null
real 0m1.011s
user 0m0.987s
sys 0m0.017s
mustang:~ fribeiro$ time
php -r "echo bcpow(12345,54321);" > /dev/null
real 0m4.350s
user 0m4.176s
sys 0m0.031s