First, let me say I am totally in favour of the sentiment here:
Python is by far the fastest to write, cleanest, more maintainable programming language I know, and that a bit of a runtime performance penalty is a small price to pay when I'm rewarded with significant productivity gains. I rarely feel Python slows me down, and on the other side I constantly marvel at how fast I code with it compared to other languages.
Personally I prefer Raku [https://raku.org] to do the same.
Here is the Python code from the article:
import sys
def fibo(n):
if n <= 1:
return n
else:
return fibo(n-1) + fibo(n-2)
if __name__ == '__main__':
for n in sys.argv[1:]:
print(n, fibo(int(n)))
And here is my Raku code:
sub MAIN(*@n) {
say (0, 1, *+* ... *)[@n]
}
So, even better on the "quick to code and easy to maintain" imo.
The performance comparison is interesting too...
CPython 9.72 - 22.10 secs
PyPy 1.65 secs
Node 1.76 secs
Rust 0.25 secs
Raku 0.12 secs
> time ./fibo.raku 10 20 30 40
(55 6765 832040 102334155)
./fibo.raku 10 20 30 40 0.12s user 0.02s system 114% cpu 0.124 total
Haha (admittedly I am on an M1 not an i5 so this is a bit Apples vs. Oranges ... but CPUs getting faster all the time and Raku has no GIL)
Python is by far the fastest to write, cleanest, more maintainable programming language I know, and that a bit of a runtime performance penalty is a small price to pay when I'm rewarded with significant productivity gains. I rarely feel Python slows me down, and on the other side I constantly marvel at how fast I code with it compared to other languages.
Personally I prefer Raku [https://raku.org] to do the same.
Here is the Python code from the article:
And here is my Raku code: So, even better on the "quick to code and easy to maintain" imo.The performance comparison is interesting too...
CPython 9.72 - 22.10 secs
PyPy 1.65 secs
Node 1.76 secs
Rust 0.25 secs
Raku 0.12 secs
Haha (admittedly I am on an M1 not an i5 so this is a bit Apples vs. Oranges ... but CPUs getting faster all the time and Raku has no GIL)