Skip to content

GaryHughes/Exchange

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

cannot access local variable 'i' where it is not associated with a value cannot access local variable 'i' where it is not associated with a value

100K orders trades
C# 0:00:00.544897 3368
F# 0:00:02.258517 3368
Go 0:00:05.497797 3368
Swift 0:00:05.682947 3368
C 0:00:09.155993 3368
Rust 0:00:11.339216 3368
C++ 0:00:19.193873 3368
Python 0:01:23.562155 3368

Part 2 Performance

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

cannot access local variable 'i' where it is not associated with a value cannot access local variable 'i' where it is not associated with a value cannot access local variable 'i' where it is not associated with a value cannot access local variable 'i' where it is not associated with a value

100K orders trades
C 0:00:00.022596 3368
Rust 0:00:00.033105 3368
C++ 0:00:00.037555 3368
Go 0:00:00.041558 3368
C# 0:00:00.181983 3368
Python 0:00:00.289110 3368
F# 0:00:00.349797 3368
Swift 0:00:00.529056 3368
10M orders trades
C 0:00:02.053864 360131
Rust 0:00:03.281401 360131
C++ 0:00:03.393043 360131
Go 0:00:04.559699 360131
C# 0:00:08.187817 360131
F# 0:00:19.212055 360131

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •