Skip to content

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

License

Notifications You must be signed in to change notification settings

jessmorecroft/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 - Cython Part 2 - Cython Part 1 - C Part 2 - C 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
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

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.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

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

Languages

  • C 50.3%
  • C++ 12.5%
  • Ruby 12.5%
  • Swift 5.5%
  • Python 4.6%
  • Rust 2.9%
  • Other 11.7%