Exchange is a playground to experiment with and compare programming languages by solving a simple problem in your language of choice and then seeing how fast you can make it run.
The problem is broken into two parts, for Part 1 the goal is to solve the basic problem using idiomatic, expressive, readable code without too much though given to performance. For Part 2 all bets are off and the goal is to make it run as fast as possible.
The solutions are benchmarked by taking the build artifacts for each language and running them 5 times over the supplied input files. The median runtime is recorded. All solutions are run on the same container instance sequentially, the results will vary depending on what resources the particular machine has at run time and will typcially be noticably slower than the results you will see on modern desktop hardware.
Some solutions are excluded from the benchmarks entirely because they take too long to run even once. Others are exluded from the benchmark with the larger file because they take too long for that particular input.
100K orders | trades | |
---|---|---|
C# | 0:00:00.459866 | 3368 |
Java | 0:00:00.868701 | 3368 |
Rust | 0:00:01.087897 | 3368 |
F# | 0:00:05.491650 | 3368 |
Swift | 0:00:07.518795 | 3368 |
C | 0:00:11.262700 | 3368 |
C++ | 0:00:20.844695 | 3368 |
Go | 0:00:42.207733 | 3368 |
Cython | 0:01:54.796626 | 3368 |
Python | 0:02:04.383852 | 3368 |
The slower implementations are excluded from the larger benchmark just so it runs in a reasonable time.
100K orders | trades | |
---|---|---|
C | 0:00:00.034274 | 3368 |
Rust | 0:00:00.047263 | 3368 |
C++ | 0:00:00.050013 | 3368 |
Go | 0:00:00.065675 | 3368 |
Cython | 0:00:00.096202 | 3368 |
C# | 0:00:00.150652 | 3368 |
Java | 0:00:00.300256 | 3368 |
F# | 0:00:00.353661 | 3368 |
Python | 0:00:01.622813 | 3368 |
Swift | 0:00:01.648586 | 3368 |
10M orders | trades | |
---|---|---|
C | 0:00:03.297271 | 360131 |
Rust | 0:00:05.453241 | 360131 |
C++ | 0:00:05.566726 | 360131 |
Go | 0:00:08.340974 | 360131 |
Cython | 0:00:08.546939 | 360131 |
Java | 0:00:11.796115 | 360131 |
C# | 0:00:13.019676 | 360131 |
F# | 0:00:27.218444 | 360131 |