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 different programming languages.

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

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”.

Language Energy Rank Mem (MB) LOC Build (h:m:s) Size (MiB) Score
Rust 1.03 1.00 66 00:11:20 7.33 3.92
C 1 4.11 102 00:02:30 5.95 4.33
Go 3.23 4.77 66 00:02:00 13.22 18.67
Dart 3.83 8.40 76 00:02:35 9.42 41.33
C++ 1.34 3.04 79 00:16:06 17.52 62.93
Java 1.98 6.80 133 00:15:09 25.96 488.86
C# 3.14 33.47 88 00:01:48 46.67 539.53
PHP 29.3 24.98 37 00:01:36 26.1 785.34
TypeScript 21.5 14.67 46 00:02:07 43.75 933.03
Python 75.88 19.77 30 00:01:24 22.54 986.22
Ruby 69.91 28.17 20 00:01:22 29.93 1118.83
F# 4.13 31.48 107 00:02:10 55.63 1164.41
Scala 1.98 96.61 70 00:03:08 78.16 2277.27
Swift 2.79 6.15 110 00:15:45 153.86 3173.68
Kotlin 1.98 308.80 80 00:04:54 69.57 11579.45
Elixir 42.23 85.03 414 00:03:02 62.21 194810.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.