Hi All! I’ve been on the search for a programming language that fullfills this criteria: Multiplatform, Small and Fast compiler, Maturity, Produces small binaries, No tightly coupled dependencies (e.g: OpenSSL), Possible control over memory management, preferably modern syntax.
The reason why is because I am interested in doing software that can run as efficient as possible, one example of a usecase that I have is that I have rented a very low powered VPS server and I want to run as many applications as possible. If you have experience about cheap VPS servers you will know that you will get banned if you have high resource usage. One could write very efficient software in Python for example but it doesn’t compare with a compiled language with focus on efficiency.
I have compiled a list of what I have found so far. I have tried most of the languages in the list, except for Odin.
Ziglang is one of my favourites, but sometimes I feel that the ecosystem is not mature enough. So many of the things you need for your software, you have to build from scratch. It’s fun to do but very time consuming.
Rust seems to be a great option with a great ecosystem, but those compilation times… everything seems to take forever! Same goes for C++.
Golang is great, it has a great ecosystem, stable, well supported, has a GC, but it provides manual memory management if required. The only bad thing about Go, is the binary size. It is not exagerated, but a simple hello world or network app shouldn’t take so much space.
Nim was good but it was tightly coupled with OpenSSL for example, here is the github issue that mentions it: https://github.com/nim-lang/Nim/issues/14719. So if I wanted to create a small networking app, I have to include OpenSSL which consumes more memory than MbedTLS or BearSSL for example.
Crystal is also dependent on OpenSSL as far as I know, and binary size is relatively high.
VLang would be great if it worked good, but there are lots of memory leaks that happen so memory increases over time. They have recently removed the tight coupling with OpenSSL which is a step in the right direction, now you can use MbedTLS if you choose to do so. The manual memory management did not work well when I tested it. I guess VLang is useful more for applications that get run once, but not continously.
I’ve just remembered that I have used the chapel programming language, but it was mostly for mathematical programming, I think it excels in that because it has direct support for GMP (numerical library) but it is not so good as a general purpose programming language.
TL;DR; What has been your experience with the languages I am mentioning in the table below in regards to memory and cpu efficiency? Do you know any other programming language that fulfills many of the criteria I have mentioned?
|Small compiler||infinite compilers. tcc is really tiny 620KB||around 200MB I’m guessing for g++||142MB||414.1 MB||42.3MB tar.xz||44 MB zip||11.4MB tar.xz||~40MB tar.gz||6.6MB zip (uses tcc, so a bit of cheating)|
|Compiler speed||Fast||Slow||Fast||Slow||Medium||???||Medium||???||Fast (uses tcc)|
|Maturity||High||High||High||High||Medium||???||High?||High?||Low? Lots of leaks|
|Tighly coupled dependencies of binaries||Low||Low||Low||Low||Low but std lib is not so extensive||???||OpenSSL||OpenSSL||Used to be OpenSSL but that was changed recently.|
|Memory management possible||Yes||Yes||Yes, although the GC is quite good||Yes||Yes||Yes||In theory yes, but all the std lib depends on GC being available?||???||??? Suposedly yes, but when I tried to manually manage the memory it was buggy|
When I have time, I try to do my little programs in Zig. When I don’t, then I use Golang. I’ve also seen TinyGo, but it has only a subset of the language.
I would love to be a pro C programmer. C runs everywhere and you can fine-tune everything, but there are so many ways in that you can shoot yourself in the foot with it.