Fortune Apps

As part of my work in VSHN, I lately prepared a set of demo applications ready to be containerized and deployed in our new product APPUiO Cloud.

The applications are available in GitLab. They have all the exact same set of features (not a lot, mind you), while being written in 15 16 18 20 different programming languages.

  1. C using the GNU libmicrohttpd system
  2. C# using the standard ASP.NET framework
  3. Crystal with the Kemal framework (article)
  4. C++ thanks to the Drogon web framework
  5. D based on the vibe.d framework
  6. Dart using the Conduit framework (article)
  7. Elixir using the Phoenix Framework (mentioned in a previous article)
  8. F# using Giraffe
  9. Go based on Gin
  10. Java using Red Hat’s Quarkus
  11. JavaScript based on Express
  12. Kotlin based on Ktor
  13. Perl with the Mojolicious web framework
  14. PHP with the Slim Framework
  15. Python using Flask (mentioned in a previous article)
  16. Ruby with Sinatra
  17. Rust using Actix and Askama (metioned in a previous article)
  18. Scala based on Scalatra
  19. Swift using the Vapor framework
  20. TypeScript based on Fresh with Deno.

Each and every one of these applications are fully containerized, and ready to run. They all offer exactly the same features:

I could not help myself getting some statistics out of these projects, and making a quick and dirty classification of these programming languages and frameworks. I gathered the following data points:

I put all the data in a LibreOffice spreadsheet, multiplied the 5 values above all together into a new score column, and ordered everything in ascending order. The build time was interpreted as a timestamp in December 1899 or something like that.

And the results are here; the lower the score, the “better”.

LanguageEnergy RankMem (MB)LOCBuild (h:m:s)Size (MiB)Score
Crystal3.52.292100:02:3111.833.48
Rust1.031.006600:11:207.333.92
C14.1110200:02:305.954.33
D3.231.875900:02:1714.338.10
Go3.234.776600:02:0013.2218.67
Dart3.838.407600:02:359.4241.33
C++1.343.047900:16:0617.5262.93
JavaScript4.4514.445800:01:4444.14198.02
Java1.986.8013300:15:0925.96488.86
C#3.1433.478800:01:4846.67539.53
PHP29.324.983700:01:3626.1785.34
TypeScript21.514.674600:02:0743.75933.03
Python75.8819.773000:01:2422.54986.22
Ruby69.9128.172000:01:2229.931118.83
F#4.1331.4810700:02:1055.631164.41
Scala1.9896.617000:03:0878.162277.27
Swift2.796.1511000:15:45153.863173.68
Perl79.5838.192900:01:34105.5710122.93
Kotlin1.98308.808000:04:5469.5711579.45
Elixir42.2385.0341400:03:0262.21194810.09


Taking everything into account, I’d consider using Go, C#, or TypeScript (in that order) for such an API anytime. With each of these three languages, the developer experience is unparalleled, the tooling is excellent, compilation times are super short, the ecosystems are huge and vibrant, and the final results are quite good (by that I mean low energy rank, low memory requirements, low SLOC, and fast build times.)

Why Go, C#, or TypeScript, and not the other programming languages?

Some other observations you might find interesting:

Finally, I used the code of all of these projects to automatically generate the documentation shown in the Getting Started page of APPUiO Cloud, thanks to the magic of Asciidoctor.

Update, 2022-06-17:: I’ve added a version using Dart. The corresponding data appears in the table above. It gets a very promising 4th place in the table, thanks to a very fast build process, a small final container size, and very low runtime memory requirements. Unfortunately the ecosystem is not very strong around Dart, but otherwise this looks like an excellent choice for a web API.

Update, 2022-07-08: Added new versions in Crystal and Perl.

Update, 2022-07-15: Crystal is a real surprise: look at the score in the table above!

Update, 2022-08-26: Moved the TypeScript version to use Fresh instead of Node.js, thereby creating a much simpler, JavaScript-only version. And then I added a new version written in the D programming language, effectively reaching the number of 20 variations for this project.