Skip to content

Repository files navigation

Part 1 - C++ Part 2 - C++ Part 1 - C# Part 2 - C# Part 1 - F# Part 2 - F# Part 1 - Go Part 2 - Go Part 1 - Rust Part 2 - Rust Part 1 - Swift Part 2 - Swift Part 1 - Java Part 2 - Java Part 1 - Python Part 2 - Python Part 1 - C Part 2 - C Part 1 - TypeScript Part 2 - TypeScript Benchmark

What is this?

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.

Benchmarks

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.

Part 1 Performance

100K orders trades
Java 0:00:00.546440 3368
C# 0:00:00.554688 3368
TypeScript 0:00:00.852772 3368
F# 0:00:02.695804 3368
Go 0:00:05.533063 3368
Swift 0:00:05.728602 3368
C 0:00:09.177197 3368
Rust 0:00:11.540527 3368
C++ 0:00:20.264579 3368
Python 0:01:31.469936 3368

Part 2 Performance

The slower implementations are excluded from the larger benchmark just so it runs in a reasonable time.

100K orders trades
C 0:00:00.023103 3368
Rust 0:00:00.024901 3368
Go 0:00:00.033897 3368
C++ 0:00:00.035772 3368
C# 0:00:00.182802 3368
Swift 0:00:00.217005 3368
Java 0:00:00.258111 3368
Python 0:00:00.304276 3368
TypeScript 0:00:00.377156 3368
F# 0:00:00.377668 3368
10M orders trades
C 0:00:02.049652 360131
Rust 0:00:02.187475 360131
C++ 0:00:03.104054 360131
Go 0:00:03.721612 360131
Java 0:00:04.601663 360131
C# 0:00:07.699063 360131
TypeScript 0:00:15.254215 360131
F# 0:00:20.618090 360131
Swift 0:00:20.756773 360131
Python 0:00:36.785738 360131

About

A toy financial instrument exchange for experimentation with and comparison of programming languages

Resources

Stars

10 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages