(has nothing to do with the drug)
“Crystal is a general-purpose, object-oriented programming language, designed and developed by Ary Borenszweig, Juan Wajnerman, Brian Cardiff and more than 300 contributors.[5] With syntax inspired by the language Ruby,[4] it is a compiled language with static type-checking, but specifying the types of variables or method arguments is generally unneeded. Types are resolved by an advanced global type inference algorithm.[6] Crystal is currently in active development. It is released as free and open-source software under the Apache License version 2.0″ (Wiki)
hello_world.cr
puts "Hello World!"
show me the src https://github.com/crystal-lang
written in: Crystal Shell Ruby JavaScript C
and: is it good? is it fast?
Matt says “yes” “very readable”.
Cool
But is it fast?
https://github.com/Matt-London/youtube-tutorial-scripts
https://github.com/Matt-London/youtube-tutorial-scripts/tree/master/speedTest
so to make any usefull comparison (this i5 CPU might or might be not faster/slower than Mr Matt London’s CPU, making this comparison unfair)
“3.0 is slower than 2.5 on official benchmarks” (src)
hostnamectl; # tested on (benchmarks were run inside Debian 11 KVM) Operating System: Debian GNU/Linux 11 (bullseye) Kernel: Linux 5.10.0-19-amd64 # host system lscpu Model name: Intel(R) Core(TM) i5-4300U CPU @ 1.90GHz Stepping: 1 CPU MHz: 2594.160 su - root apt update apt install python2 python3; # install if not already # there is a "bash" (?) build in time command but it is not the same apt install time Ctrl+D; # logout as root, become non-root again # download it git clone https://github.com/Matt-London/youtube-tutorial-scripts.git python; # there are many versions python2 python2.7 python3 python3.9 ./speedTest.sh python3.9 pyTest.py; # bench python3.9 real 11.679 ./speedTest.sh python3 pyTest.py; # bench python3 real 11.688; # basically same speed as 3.9 ./speedTest.sh python2.7 pyTest.py; # bench python2.7 real 10.662 ./speedTest.sh python2 pyTest.py; # bench python2 real 9.355 <- so python2 IS STILL the fastest python, that's the reason why it is still around...
bench PHP8.1
hint: opening a file with “hard coded” array of 10.000x numbers… Eclipse PDT will simply stall! X-D (Java’s massive memory requirements fault?)
(vim not… but the syntax highlighting gave up half way… after 5000 numbers)
here it is, the: “PHP8.1_bench_bubblesort_10000_numbers_speedTest” aka Matt London speed test:
https://dwaves.de/upload/bench/MattLondonSpeedTest_v1.php.txt
- install php8.1
- run it properly
# this way, the output is more meaningful, as the OS & CPU & PHP version are also included
hostnamectl; lscpu; php --version; ./speedTest.sh php MattLondonSpeedTest_v1.php real 6.055 <- so this makes php8.1 perform somewhere between Ruby and Crystal (but Crystal really seems pretty fast)
btw: (completely unrelated)
liked this article?
- only together we can create a truly free world
- plz support dwaves to keep it up & running!
- (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
- really really hate advertisement
- contribute: whenever a solution was found, blog about it for others to find!
- talk about, recommend & link to this blog and articles
- thanks to all who contribute!