Timing 'Hello, world'
Here's a little unscientific chart showing the compile/run times of a "hello world" program in different languages:
Hello world timings
Lua 338 ms ■■■
PHP 364 ms ■■■■
C 380 ms ■■■■
Python 410 ms ■■■■
JavaScript 427 ms ■■■■
Ruby 427 ms ■■■■
Rust 460 ms ■■■■■
Bash 482 ms ■■■■■
V 498 ms ■■■■■
Swift 524 ms ■■■■■
R 537 ms ■■■■■
Go 609 ms ■■■■■■
Haskell 858 ms ■■■■■■■■
C++ 935 ms ■■■■■■■■■
Zig 975 ms ■■■■■■■■■■
Elixir 1249 ms ■■■■■■■■■■■■
C# 1335 ms ■■■■■■■■■■■■■
Java 1695 ms ■■■■■■■■■■■■■■■■■
Odin 1741 ms ■■■■■■■■■■■■■■■■■
Dart 1891 ms ■■■■■■■■■■■■■■■■■■■
Kotlin 8385 ms ■■■■■■■■■■■■■■■■■■■■■■■■■■■■...■■■■■■■■■■■■■■■■■■■■■■■■■■■■
For interpreted languages, the times shown are only for running the program, since there's no separate compilation step.
I had to shorten the Kotlin bar a bit to make it fit within 80 characters.
All measurements were done in single-core, containerized sandboxes on an ancient AMD CPU, so the exact times aren't very interesting, but the relative timings are.
Here is the program source code in C:
#include <stdio.h>
void greet(const char* name) {
printf("Hello, %s!\n", name);
}
int main() {
greet("World");
}
Hello, World!
Other languages: Bash · C# · C++ · Dart · Elixir · Go · Haskell · Java · JavaScript · Kotlin · Lua · Odin · PHP · Python · R · Ruby · Rust · Swift · V · Zig
Of course, this ranking will be different for real-world projects with lots of code and dependencies. Still, I found it curious to see how each language performs on a simple "hello world" task.
★ Subscribe to keep up with new posts.