Skip to content

Benchmarks of different languages achieving the same simple task.

License

Notifications You must be signed in to change notification settings

Testausserveri/benchmarks

Repository files navigation

Benchmarks

The goal of each language is to execute the pseudo code of

answer = 0
for (a = 1; a <= 65535; a++) {
   for (b = 1; b <= 65535; b++) {
     if (a % b == 0) answer++
   }
}

and return the answer and time in seconds it took to calculate.

Results

Benchmark results of GitHub Actions runner. Smaller is better.

# Name Time Answer
1 Lua (LuaJIT) 6.028707s 736957
2 Rust 7.965s 736957
3 C++ (G++) 7.965297s 736957
4 C (GCC) 7.965645s 736957
5 C# 7.972789s 736957
6 Java 7.979s 736957
7 Node.js 8.009255153000005s 736957
8 Go 9.298125702s 736957
9 Python (PyPy3) 10.992793798446655s 736957

Dependencies

Each program needs to be added to PATH if the associated installer or package doesn't do so automatically.

*You should select x86_64 architecture, POSIX threads, and SEH exceptions for your MinGW installation.

Running

Simply run the bench script (bench.bat on Windows) and wait for all the results. You may notice some new files as languages like C, C++, C#, Java, and Rust need to be compiled and leave build artefacts. If there is an error, ensure that the program that errored is installed and on the PATH environment variable. If it is and it keeps erroring or crashing, then open an issue.

About

Benchmarks of different languages achieving the same simple task.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published