-
-
Save Altai-man/307a095d3e05265cf470238a243bd8af 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
my $total-re = 0; | |
for ^10_000_000 { | |
my $x = 5 + 2i; | |
my $y = 10 + 3i; | |
my $z = $x * $x + $y; | |
$total-re = $total-re + $z.re | |
} |
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
total = 0; | |
i = 0; | |
while i < 10000000: | |
x = 5 + complex(0, 2) | |
y = 10 + complex(0, 3) | |
z = x * x + y | |
total = total + z.real | |
i += 1 |
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
[koto@dispair ~]$ python3 --version | |
Python 3.6.9 | |
[koto@dispair ~]$ perl6 --version | |
This is Rakudo version 2019.07 built on MoarVM version 2019.07 | |
implementing Perl 6.d. | |
[koto@dispair ~]$ cat /proc/cpuinfo | grep name | |
model name : Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz | |
model name : Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz | |
model name : Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz | |
model name : Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz | |
[koto@dispair ~]$ cat python3.py | |
total = 0; | |
i = 0; | |
while i < 10000000: | |
x = 5 + complex(0, 2) | |
y = 10 + complex(0, 3) | |
z = x * x + y | |
total = total + z.real | |
i += 1 | |
[koto@dispair ~]$ time python3 python3.py | |
real 0m8.207s | |
user 0m8.170s | |
sys 0m0.012s | |
[koto@dispair ~]$ cat perl6.p6 | |
my $total-re = 0; | |
for ^10_000_000 { | |
my $x = 5 + 2i; | |
my $y = 10 + 3i; | |
my $z = $x * $x + $y; | |
$total-re = $total-re + $z.re | |
} | |
[koto@dispair ~]$ time perl6 perl6.p6 | |
real 0m3.192s | |
user 0m3.210s | |
sys 0m0.032s | |
[koto@dispair ~]$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment