Memory consumption of a web application in different programming languages
You probably have your opinion on which programming language to use for a larger project, but imagine you have a very small project, and you want it to consume as little memory as possible.
I did a comparison, creating a web application that just returns the string “Hello, World!” in a bunch of programming languages, put them on docker containers, and used docker stats to measure the memory consumption.
The programs were generated by GPT-4, using whatever http-server library it chose, to avoid my own bias to influence it. Not saying GPT-4 is unbiased, but it’s a different bias. The code is available on GitHub.
Language | Memory consumption |
---|---|
python | 26.3 MiB |
typescript (tsx) | 79.0 MiB |
rust | 15.4 MiB |
csharp | 22.7 MiB |
cpp | 2.32 MiB |
node.js | 13.8 MiB |
java | 52.9 MiB |
go | 7.0 MiB |
raku | 345 MiB |